-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Navigation types #6517
Comments
Something I'd floated at the last maintainers meeting was the possibility of And, relatedly, is this proposal, as currently written, something that would apply just to the lifecycle hooks, or would it be for the |
It would apply to I'm slightly hesitant to lump invalidation in here as well — it feels like you might want more of a separation between the concepts (and should it be possible to Someone tell me the correct answer please |
I haven't used Would it be an unacceptable caveat to make |
Would it also be a good idea to add a 'submitting' type when the upcoming Form component is used? I know that Remix has something like that. As for invalidation, I think its a good idea to include it, and being able to cancel it makes sense to me (cancelling the fetch requests and the data update), albeit maybe a rare use case. |
Yeah, I think it would be weird to include Am more getting hung up on whether it makes sense to combine the 'navigation' and 'invalidation' concepts. They definitely have overlap (and implementation-wise are very similar), am just trying to figure out if the differences are likely to cause issues down the line. For example in #5478 (comment) I suggest including a I'm leaning towards
How would you envisage using it? Presumably anywhere you're in a position to pass in a callback you could already do this: before();
await invalidate(...);
after(); |
I think that's better off living in the component than in the framework — you could have multiple forms submitting simultaneously, for example |
This is great! Only thing I'm not sure about yet is
|
@dummdidumm Maybe instead of let includeInvalidate = true;
beforeNavigate(({ from, to, type }) => {}, includeInvalidate); ? Or a separate function that includes invalidate.... |
Also related: #6375 |
I think this would unquestionably get annoying, and moreover be an easy footgun |
Describe the problem
Relevant: #4447, #4383, #6498.
The
navigating
store value is a{ from: URL, to: URL }
object, which is also passed tobeforeNavigate
(along with acancel
method) andafterNavigate
callbacks.Often, it's useful to know what type of navigation is happening — whether we're coming from or going to a different document, or we navigated within the site to a different route by clicking on a link, or via
goto
, or by apopstate
event (i.e. traversing thehistory
). If it's a history traversal, it's also useful to know the delta (or at least whether we're going forward or back).Describe the proposed solution
Since the types are mutually exclusive, it probably makes sense to be an enum, rather than
or something of that nature. Delta can be reported in a separate property that would only apply in the
popstate
case:(
load
isn't pictured because it would never be fired in thebeforeNavigate
case, just likeunload
would never appear inafterNavigate
.)Alternatives considered
No response
Importance
would make my life easier
Additional Information
No response
The text was updated successfully, but these errors were encountered: