If all fragments in a visit already match visit.to.url, currently the matching fragment visit will simply be ignored, falling back to swups default containers for that visit.
That is not what would be expected. That kind of situation is basically like a link to the current page, even though the visit.from.url is not equal to visit.to.url.
Describe the propsed solution π
I've done a bit of research in #79 and then decided to first start with an issue.
I'm unsure about the ideal solution for the scenario described above. Maybe the behavior could be aligned with whatever is defined in swup.options.linkToSelf:
if linkToSelf is scroll, nothing should happen (matching fragment visit, empty containers)
if linkToSelf is set to navigate, the fragments should be reloaded (matching fragment visit with the containers of the matched rule)
As mentioned above, I'm not absolutely sure about the perfect solution here. Happy to talk it all through together.
Alternatives considered π€
Add a hook and always remove the fragment URL from the fragment element:
/** allow details to always be replaced */
swup.hooks.on("visit:end", () => {
const detail = $<FragmentElement>("#detail")!;
detail.__swupFragment!.url = "";
});
Describe the problem π§
If all fragments in a visit already match
visit.to.url
, currently the matching fragment visit will simply be ignored, falling back to swups default containers for that visit.That is not what would be expected. That kind of situation is basically like a link to the current page, even though the
visit.from.url
is not equal tovisit.to.url
.Describe the propsed solution π
I've done a bit of research in #79 and then decided to first start with an issue.
I'm unsure about the ideal solution for the scenario described above. Maybe the behavior could be aligned with whatever is defined in
swup.options.linkToSelf
:linkToSelf
isscroll
, nothing should happen (matching fragment visit, emptycontainers
)linkToSelf
is set tonavigate
, the fragments should be reloaded (matching fragment visit with the containers of the matched rule)As mentioned above, I'm not absolutely sure about the perfect solution here. Happy to talk it all through together.
Alternatives considered π€
Add a hook and always remove the fragment URL from the fragment element:
How important is this feature to you? π§
Would make my life a lot easier
Checked all these? π