Skip to content
Merged
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
8 changes: 4 additions & 4 deletions src/py/reactpy/reactpy/backend/starlette.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

def configure(
app: Starlette,
constructor: RootComponentConstructor,
component: RootComponentConstructor,
options: Options | None = None,
) -> None:
"""Configure the necessary ReactPy routes on the given app.
Expand All @@ -49,7 +49,7 @@ def configure(
options = options or Options()

# this route should take priority so set up it up first
_setup_single_view_dispatcher_route(options, app, constructor)
_setup_single_view_dispatcher_route(options, app, component)

_setup_common_routes(options, app)

Expand Down Expand Up @@ -129,7 +129,7 @@ async def serve_index(request: Request) -> HTMLResponse:


def _setup_single_view_dispatcher_route(
options: Options, app: Starlette, constructor: RootComponentConstructor
options: Options, app: Starlette, component: RootComponentConstructor
) -> None:
@app.websocket_route(str(STREAM_PATH))
@app.websocket_route(f"{STREAM_PATH}/{{path:path}}")
Expand All @@ -145,7 +145,7 @@ async def model_stream(socket: WebSocket) -> None:
await serve_layout(
Layout(
ConnectionContext(
constructor(),
component(),
value=Connection(
scope=socket.scope,
location=Location(pathname, f"?{search}" if search else ""),
Expand Down