Skip to content

Commit cb7e279

Browse files
committed
self review
1 parent dd7179c commit cb7e279

File tree

5 files changed

+15
-14
lines changed

5 files changed

+15
-14
lines changed

CHANGELOG.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ Using the following categories, list your changes in this order:
3737
### Added
3838

3939
- Client-side Python components can now be rendered via the new `{% pyscript_component %}` template tag
40-
- PyScript's can be made accessible for an existing page using the `{% pyscript_setup %}` template tag
41-
- This tag can also be used to load additional dependencies, or change the default PyScript configuration.
40+
- You must first call the `{% pyscript_setup %}` template tag to load PyScript dependencies
4241
- Client-side components can be embedded into existing server-side components via `reactpy_django.components.pyscript_component`.
43-
- You can now write Python code that runs within client browser via the `reactpy_django.html.pyscript` element. This is a viable substitution for most JavaScript code.
42+
- Tired of writing JavaScript? You can now write PyScript code that runs directly within client browser via the `reactpy_django.html.pyscript` element.
43+
- This is a viable substitution for most JavaScript code.
4444

4545
### Changed
4646

@@ -56,7 +56,7 @@ Using the following categories, list your changes in this order:
5656

5757
### Removed
5858

59-
- `QueryOptions` and `MutationOptions` have been removed. Their values are now passed direct into the hook.
59+
- `QueryOptions` and `MutationOptions` have been removed. The value contained within these objects are now passed directly into the hook.
6060

6161
### Fixed
6262

docs/src/reference/router.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ URL router that enables the ability to conditionally render other components bas
2020

2121
!!! warning "Pitfall"
2222

23-
All pages where `django_router` is used must have the same, or more permissive URL exposure within Django's [URL patterns](https://docs.djangoproject.com/en/5.0/topics/http/urls/#example). You can think of this component as a secondary, client-side router. Django still handles the primary server-side routes.
23+
All pages where `django_router` is used must have identical, or more permissive URL exposure within Django's [URL patterns](https://docs.djangoproject.com/en/5.0/topics/http/urls/#example). You can think of the router component as a secondary, client-side router. Django still handles the primary server-side routes.
2424

2525
We recommend creating a route with a wildcard `.*` to forward routes to ReactPy. For example...
2626
`#!python re_path(r"^/router/.*$", my_reactpy_view)`

docs/src/reference/template-tag.md

+7-5
Original file line numberDiff line numberDiff line change
@@ -225,11 +225,13 @@ Your PyScript component file requires a `#!python def root()` component to funct
225225

226226
??? question "Does my entire component need to be contained in one file?"
227227

228-
PyScript components do not have access to your local disk, and thus cannot `#!python import` any local Python modules.
228+
Splitting a large file into multiple files is a common practice in software development.
229229

230-
To bypass this, you can declare multiple file paths. These files will automatically combined during processing.
230+
However, PyScript components are run on the client browser. As such, they do not have access to your local development environment, and thus cannot `#!python import` any local Python files.
231231

232-
Here is how we recommend doing that while retaining type hints.
232+
If your PyScript component file gets too large, you can declare multiple file paths instead. These files will automatically combined by ReactPy.
233+
234+
Here is how we recommend splitting your component into multiple files while avoiding local imports but retaining type hints.
233235

234236
<!--pyscript-multifile-end-->
235237

@@ -295,9 +297,9 @@ Your PyScript component file requires a `#!python def root()` component to funct
295297

296298
## PyScript Setup
297299

298-
This template tag configures the current page to be able to run `pyscript` by loading PyScript's static files.
300+
This template tag configures the current page to be able to run `pyscript`.
299301

300-
You can optionally include a list of Python packages to install within the PyScript environment, or a [PyScript configuration dictionary](https://docs.pyscript.net/2024.6.1/user-guide/configuration/).
302+
You can optionally use this tag to configure the current PyScript enviroment. For example, you can include a list of Python packages to automatically install within the PyScript environment.
301303

302304
=== "my_template.html"
303305

src/reactpy_django/components.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -327,9 +327,8 @@ def _pyscript_component(
327327
executor = render_pyscript_template(file_paths, uuid, root)
328328

329329
if not rendered:
330-
# FIXME: This is needed to properly re-render PyScript such as
331-
# during a WebSocket disconnection / reconnection.
332-
# There may be a better way to do this in the future.
330+
# FIXME: This is needed to properly re-render PyScript during a WebSocket
331+
# disconnection / reconnection. There may be a better way to do this in the future.
333332
set_rendered(True)
334333
return None
335334

src/reactpy_django/pyscript/component_template.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def user_workspace_UUID():
1414
This code is designed to be run directly by PyScript, and is not intended to be run
1515
in a normal Python environment.
1616
17-
ReactPy-Django's template tag performs string substitutions to turn this file into valid PyScript.
17+
ReactPy-Django performs string substitutions to turn this file into valid PyScript.
1818
"""
1919

2020
def root(): ...

0 commit comments

Comments
 (0)