reactive-python / reactpy

It's React, but in Python
https://reactpy.dev
MIT License
7.84k stars 316 forks source link

Modify `SimpleReactPyClient` to not use pre-defined endpoints #1079

Open Archmonger opened 1 year ago

Archmonger commented 1 year ago

Current Situation

We currently require a structured/implict routes for SimpleReactPyClient.

/*
 * - `_reactpy/stream/${route}${query}`: The websocket endpoint for the stream.
 * - `_reactpy/modules`: The directory containing the dynamically loaded modules.
 * - `_reactpy/assets`: The directory containing the static assets.
*/ 

Proposed Actions

Rewrite SimpleReactPyClient to allow the user to define their own routes. Will need a prop for each route.

Similar to reactpy-django, we need the following customization options:

Note: We need to start treating the client JS file completely separately from other static files. The user needs can't ever configure their static file dir if we rely on it for core behavior.

Archmonger commented 1 year ago

@rmorshea In order to plan for easy compatibility between template tags and ASGI middleware, I'd like us to remove the hacky URL routing workaround from reactpy/stream/. As we discussed, that's going to require use_messenger to get to that point.

The new websocket URL pattern should be reactpy/<component_dotted_path>/