Closed hirasso closed 3 months ago
 12 passed
 12 tests across 1 suite
Â
 6b6d10d
An alternative could be to check if all containers for the current visit already match the visit.to.url
, and if so, replace them anyways. @daun Maybe this is something we should discuss in a call.
Closing this as I'd like to go through all this in an issue first.
Description
I just stumbled upon a case where the sole fragment that was being targeted for the current visit already had the same fragment url as
visit.to.url
, causing a normal (non-fragment) visit that broke as of course thecontainers
were missing (hard to explain 😅). ~Allowing visits that don't replace anything was exactly what I needed in this case~.Actually, the comment I posted below lead me to the real solution: Treat a visit as a reload, if all fragment elements already match that visit's
visit.to.url
. In other words: Don't skip fragments as described in https://swup.js.org/plugins/fragment-plugin/#how-fragment-containers-are-found, bullet 3, if otherwise no fragments would be replaced at all.Drive-By
visit
introduced forrule.if
had the wrong route if being called as an API function. It will now be created on the fly usingswup.createVisit(route)
.Checks
master
branchnpm run lint
)npm run test
)Additional information