Skip to content

Fix query and mutation docs examples & fix docs typo #240

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/examples/python/use-mutation-query-refetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def submit_event(event):
elif item_query.error or not item_query.data:
rendered_items = html.h2("Error when loading!")
else:
rendered_items = html.ul(html.li(item, key=item) for item in item_query.data)
rendered_items = html.ul(html.li(item, key=item.pk) for item in item_query.data)

# Handle all possible mutation states
if item_mutation.loading:
Expand Down
4 changes: 3 additions & 1 deletion docs/examples/python/use-query.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ def todo_list():
elif item_query.error or not item_query.data:
rendered_items = html.h2("Error when loading!")
else:
rendered_items = html.ul([html.li(item, key=item) for item in item_query.data])
rendered_items = html.ul(
[html.li(item, key=item.pk) for item in item_query.data]
)

return html.div("Rendered items: ", rendered_items)
8 changes: 1 addition & 7 deletions docs/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,7 @@ watch:
site_name: ReactPy-Django
site_author: Archmonger
site_description: It's React, but in Python. Now with Django integration.
copyright: '©
<div id="year"></div>
<script> document.getElementById("year").innerHTML = new Date().getFullYear(); </script>
Reactive Python and affiliates.
<div class="legal-footer-right">
This project has no affiliation to ReactJS or Meta Platforms, Inc.
</div>'
copyright: '&copy; <div id="year"></div> <script>document.getElementById("year").innerHTML = new Date().getFullYear();</script> Reactive Python and affiliates. <div class="legal-footer-right">This project has no affiliation to ReactJS or Meta Platforms, Inc.</div>'
repo_url: https://github.com/reactive-python/reactpy-django
site_url: https://reactive-python.github.io/reactpy-django
repo_name: ReactPy Django (GitHub)
Expand Down
2 changes: 1 addition & 1 deletion docs/src/reference/template-tag.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Each component loaded via this template tag will receive a dedicated WebSocket c
| `#!python *args` | `#!python Any` | The positional arguments to provide to the component. | N/A |
| `#!python class` | `#!python str | None` | The HTML class to apply to the top-level component div. | `#!python None` |
| `#!python key` | `#!python Any` | Force the component's root node to use a [specific key value](https://reactpy.dev/docs/guides/creating-interfaces/rendering-data/index.html#organizing-items-with-keys). Using `#!python key` within a template tag is effectively useless. | `#!python None` |
| `#!python host` | `#!python str | None` | The host to use for the ReactPy connections. If unset, the host will be automatically configured.<br/>Example values include: `localhost:8000`, `example.com`, `example.com/subdir` | `#!python None` |
| `#!python host` | `#!python str | None` | The host to use for ReactPy connections. If unset, the host will be automatically configured.<br/>Example values include: `localhost:8000`, `example.com`, `example.com/subdir` | `#!python None` |
| `#!python prerender` | `#!python str` | If `#!python "true"` the component will pre-rendered, which enables SEO compatibility and reduces perceived latency. | `#!python "false"` |
| `#!python offline` | `#!python str` | The dotted path to a component that will be displayed if your root component loses connection to the server. Keep in mind, this `offline` component will be non-interactive (hooks won't operate). | `#!python ""` |
| `#!python **kwargs` | `#!python Any` | The keyword arguments to provide to the component. | N/A |
Expand Down
2 changes: 1 addition & 1 deletion src/reactpy_django/templatetags/reactpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def component(
class: The HTML class to apply to the top-level component div.
key: Force the component's root node to use a specific key value. Using \
key within a template tag is effectively useless.
host: The host to use for the ReactPy connections. If set to `None`, \
host: The host to use for ReactPy connections. If set to `None`, \
the host will be automatically configured. \
Example values include: `localhost:8000`, `example.com`, `example.com/subdir`
prerender: Configures whether to pre-render this component, which \
Expand Down
2 changes: 1 addition & 1 deletion src/reactpy_django/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ def django_query_postprocessor(

# `QuerySet`, which is an iterable of `Model`/`QuerySet` instances
# https://github.com/typeddjango/django-stubs/issues/704
if isinstance(data, QuerySet): # type: ignore[misc]
if isinstance(data, QuerySet):
for model in data:
django_query_postprocessor(
model,
Expand Down
Loading