Skip to content

Commit 2949aa6

Browse files
authored
Fix docs examples, docs typo fix (#240)
- Fix broken docs examples for `use_query` and `use_mutation` - Fix misc docs typo
1 parent d45d2ec commit 2949aa6

File tree

6 files changed

+8
-12
lines changed

6 files changed

+8
-12
lines changed

docs/examples/python/use-mutation-query-refetch.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def submit_event(event):
2626
elif item_query.error or not item_query.data:
2727
rendered_items = html.h2("Error when loading!")
2828
else:
29-
rendered_items = html.ul(html.li(item, key=item) for item in item_query.data)
29+
rendered_items = html.ul(html.li(item, key=item.pk) for item in item_query.data)
3030

3131
# Handle all possible mutation states
3232
if item_mutation.loading:

docs/examples/python/use-query.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ def todo_list():
1717
elif item_query.error or not item_query.data:
1818
rendered_items = html.h2("Error when loading!")
1919
else:
20-
rendered_items = html.ul([html.li(item, key=item) for item in item_query.data])
20+
rendered_items = html.ul(
21+
[html.li(item, key=item.pk) for item in item_query.data]
22+
)
2123

2224
return html.div("Rendered items: ", rendered_items)

docs/mkdocs.yml

+1-7
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,7 @@ watch:
124124
site_name: ReactPy-Django
125125
site_author: Archmonger
126126
site_description: It's React, but in Python. Now with Django integration.
127-
copyright: '©
128-
<div id="year"></div>
129-
<script> document.getElementById("year").innerHTML = new Date().getFullYear(); </script>
130-
Reactive Python and affiliates.
131-
<div class="legal-footer-right">
132-
This project has no affiliation to ReactJS or Meta Platforms, Inc.
133-
</div>'
127+
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>'
134128
repo_url: https://github.com/reactive-python/reactpy-django
135129
site_url: https://reactive-python.github.io/reactpy-django
136130
repo_name: ReactPy Django (GitHub)

docs/src/reference/template-tag.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Each component loaded via this template tag will receive a dedicated WebSocket c
2828
| `#!python *args` | `#!python Any` | The positional arguments to provide to the component. | N/A |
2929
| `#!python class` | `#!python str | None` | The HTML class to apply to the top-level component div. | `#!python None` |
3030
| `#!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` |
31-
| `#!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` |
31+
| `#!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` |
3232
| `#!python prerender` | `#!python str` | If `#!python "true"` the component will pre-rendered, which enables SEO compatibility and reduces perceived latency. | `#!python "false"` |
3333
| `#!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 ""` |
3434
| `#!python **kwargs` | `#!python Any` | The keyword arguments to provide to the component. | N/A |

src/reactpy_django/templatetags/reactpy.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def component(
5151
class: The HTML class to apply to the top-level component div.
5252
key: Force the component's root node to use a specific key value. Using \
5353
key within a template tag is effectively useless.
54-
host: The host to use for the ReactPy connections. If set to `None`, \
54+
host: The host to use for ReactPy connections. If set to `None`, \
5555
the host will be automatically configured. \
5656
Example values include: `localhost:8000`, `example.com`, `example.com/subdir`
5757
prerender: Configures whether to pre-render this component, which \

src/reactpy_django/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ def django_query_postprocessor(
277277

278278
# `QuerySet`, which is an iterable of `Model`/`QuerySet` instances
279279
# https://github.com/typeddjango/django-stubs/issues/704
280-
if isinstance(data, QuerySet): # type: ignore[misc]
280+
if isinstance(data, QuerySet):
281281
for model in data:
282282
django_query_postprocessor(
283283
model,

0 commit comments

Comments
 (0)