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 reload #335

Open
arctic-hen7 opened this issue Jan 23, 2022 · 2 comments
Open

Router reload #335

arctic-hen7 opened this issue Jan 23, 2022 · 2 comments
Labels
A-router Area: router C-enhancement Category: new feature or improvement to existing feature
Milestone

Comments

@arctic-hen7
Copy link
Contributor

Right now, Sycamore's router supports navigating to a new page and also replacing the current entry in the history. Extending on this, it would be useful if the router could reload the current route. At first, I know this seems completely pointless, but, as I've discovered through Perseus' state freezing, it's not! Right now, if you call navigate(url) where url is the same as the current page, the code in the Router callback doesn't run, nor should it.

However, there are cases, particularly for high-level contexts that have been updated, in which reloading a page with new state is extremely useful. This seems to be the offending code:

// Same page. Do nothing.
ev.prevent_default();

While I accept that this is a great default, it would be very useful to have a function that bypasses it to enable reloading the current route. Notably, this would probably require a not insignificant refactor of the router, which I'm probably not the best person to attempt due to my unfamiliarity with its intricacies.

@arctic-hen7 arctic-hen7 added the C-enhancement Category: new feature or improvement to existing feature label Jan 23, 2022
@lukechu10 lukechu10 added the A-router Area: router label Jan 25, 2022
@johan-smits
Copy link

Is there a update on this?

@lukechu10 lukechu10 added this to the v0.9 milestone Sep 21, 2022
@lukechu10
Copy link
Collaborator

Ah no sorry. I shall focus a lot on router for the next major update and will try to address this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-router Area: router C-enhancement Category: new feature or improvement to existing feature
Projects
None yet
Development

No branches or pull requests

3 participants