Help with intercepting routes - retain context after refresh/share of URL?
Unanswered
Albacore posted this in #help-forum
AlbacoreOP
I am trying to make an intercepted route retain its context after refresh/share of the URL. Is there a feature that would enable this, eg. maybe adding URL params so that the route can load its context later? Or is this an indication that intercepting routes aren't what we should be using here? Or is this just something I would have to implement myself?
Here's a simplified diagram of our directory setup:
If the user lands on
Initially it seemed like, since the content of the page is the same but only the layout changes, that this would make sense as a use case for intercepting routes - but once I realized that refreshing/sharing URL loses the context, I'm not so sure anymore. Should I even be using intercepting routes here? Or should I keep using them, and implement my own URL params to retain context?
Thanks!
Here's a simplified diagram of our directory setup:
app
product
[id]
edit
page.tsx
create
page.tsx
layout.tsx
(..)[id]
edit
page.tsxIf the user lands on
/product/create/ and is then directed to /product/5/edit, the content should be displayed within the create layout. This all works fine - however, if the user refreshes, they should stay in the create layout, since the regular edit page only makes sense for products that have already progressed through the edit flow. If the user loses the context of which flow they were in after they refresh, it's going to be confusing for them.Initially it seemed like, since the content of the page is the same but only the layout changes, that this would make sense as a use case for intercepting routes - but once I realized that refreshing/sharing URL loses the context, I'm not so sure anymore. Should I even be using intercepting routes here? Or should I keep using them, and implement my own URL params to retain context?
Thanks!
2 Replies
AlbacoreOP
Bump for visibility
AlbacoreOP
Bump for visibility