Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Router #362

Open
Tracked by #50
dsmmcken opened this issue Mar 15, 2024 · 1 comment
Open
Tracked by #50

Router #362

dsmmcken opened this issue Mar 15, 2024 · 1 comment

Comments

@dsmmcken
Copy link
Contributor

dsmmcken commented Mar 15, 2024

We should expose react-router to query writers so they can build pages and links:

# redirect to another route in a function
a = ui.dashboard(
   return table.on_row_press(lamda data: ui.redirect("/my-other-dash/data['sym']")
)

# hooks for url location and params
b = ui.dashboard(
     [sym] = ui.use_params([null])
     return t = table.where(f"{sym}"
)

# works like react router link, doing SPA navigation
home = ui.dashboard(
  return ui.link("My Dash", href="/my-dash")

# declare a router with paths and the component the path loads
router = ui.router({
  "/": home,
  "/my-dash" : a,
  "/my-other-dash/:sym" : b,
})

On enterprise we could include the pq name as part of the path /app/{pq-name}/my-dash, implicitly if the link is for the current PQ, and explicitly for linking to other PQs.

ui.link("My Dash", href="/my-dash") # implicitly the current pq
ui.link("My Other PQ Dash", href="/app/my-other-pq/my-dash")
@dsmmcken dsmmcken mentioned this issue Mar 15, 2024
89 tasks
@mofojed
Copy link
Member

mofojed commented Mar 15, 2024

What if multiple scripts register the same routes? Does a user “open” the router object or does it automatically register?
How are the implicit vs. explicit links differentiated?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants