-
-
Notifications
You must be signed in to change notification settings - Fork 27
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
[RFC] Prevent routing to current path #28
Comments
In SPAs, I would think not repeat the |
Leaning towards @TehShrike's suggestion of allowing the route's handler(s) to rerun but preventing extra This maintains the ability of refreshing the page (if your App allows) by clicking the home/logo repeatedly. This could be prevented & disabled within App if that's undesired. By contrast, my initial suggestion required you to supply a dedicated "refresh" button and/or require users to hard-reload the page. That seems wrong. The nice thing is that this adds only ~6 bytes and is not a breaking change. |
In a static site, if you click a link that navigates to the same page you are on, the browser still sends the HTTP request, allowing the server to send updated data, but the history stack does not change. (In Firefox 75.0 at least.) To keep that user experience consistent, clicking repeatedly on a link to a page that you are already at should rerun the route handler(s) but not push to the history stack. |
Agreed :) You both have convinced me |
Assuming this setup:
You will be
doing something
every time the"/"
path is routed. This is common sense & to be expected. However, what might not be obvious is that if you have a standard link in a global component (eg, a navbar) pointing to the home page:... and click it repeatedly, you will be
doing something
for each of those clicks, even though you're already on the"/"
route.This is posted as a RFC because it might qualify as a breaking change in some apps.
Many might actually be relying on this behavior to reset page state, for example.
Please let me know below :)
The text was updated successfully, but these errors were encountered: