Skip to content

Commit

Permalink
Directly register dynamic route args
Browse files Browse the repository at this point in the history
Avoid the hack of adding a page that will fail to evaluate. This doesn't work
in recent reflex versions since page evaluation is delayed.
  • Loading branch information
masenf committed Nov 26, 2024
1 parent 449581d commit 7bf029e
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions form-designer/form_designer/form_designer.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,8 @@
app = rx.App(theme=rx.theme(accent_color="blue"))
app.add_page(home_page, route="/", title=constants.TITLE)

# Adding a dummy route to register the dynamic route vars.
with contextlib.suppress(ValueError):
app.add_page(
lambda: rx.fragment(on_click=rx.event.noop()),
route="/_dummy/[form_id]/[field_id]",
)
# Register the dynamic route vars.
rx.State.setup_dynamic_args(rx.app.get_route_args("/_dummy/[form_id]/[field_id]"))

# Authentication via reflex-local-auth
app.add_page(
Expand Down Expand Up @@ -97,4 +93,4 @@
)

# Create the database if it does not exist (hosting service does not migrate automatically)
rx.Model.migrate()
rx.Model.migrate()

0 comments on commit 7bf029e

Please sign in to comment.