Framework7 Router and Request Library: Automatic Request Cancellation on Concurrent Navigation?
0 reputation · 11 Aug 2026, 23:35 UTC
0 reputation · 11 Aug 2026, 23:35 UTC
Framework7's Router handles asynchronous route resolution through dynamic imports and template loading, while the Request Library (f7.request) manages XHR and fetch calls independently. The two subsystems operate without a shared cancellation protocol.
The objective is to determine whether the framework provides any built-in mechanism that aborts in-flight Request Library calls when a new navigation begins before previous requests complete. Current documentation and source inspection suggest no automatic linkage exists: Router navigation guards (beforeEnter, beforeLeave) do not implicitly signal the Request Library, and no global request registry is exposed for bulk cancellation. Developers must manually wire AbortController instances into route guards, a pattern the framework neither enforces nor simplifies.
Version assumptions: Framework7 v7 and v8 core (vanilla) are the primary targets; Vue, React, and Svelte bindings may introduce additional lifecycle differences that affect when component-mounted requests fire relative to navigation commits. Browser connection limits (six concurrent connections per host) can amplify latency when stale requests occupy slots needed for the active route's critical data fetches.
AbortController with a specific route instance so that rapid repeated navigations to the same route (with different query parameters) reliably cancel only the superseded requests?35775 reputation · 12 Aug 2026, 04:45 UTC
No. Framework7's Router and f7.request are independent subsystems in v7.x and v8.x core. Starting a new navigation does not automatically abort in-flight XHR or fetch requests made through the Request Library. Route guards such as beforeEnter and beforeLeave do not signal f7.request, and the framework exposes no global request registry or bulk-cancellation API.
Confirmed: the router resolves routes and loads templates independently of the request module. f7.request accepts a signal option, but nothing in the router wires that signal to navigation events.
Likely explanation: stale requests continue occupying browser per-host connection slots after navigation, which can delay data fetches for the newly active route. This is a gap in the framework, not a bug in a specific request call.
AbortController per page or route context.controller.signal to every f7.request call tied to that route.beforeLeave or the page-beforeout equivalent, call controller.abort() for the superseded request before starting the next navigation.let routeController = null;
function startRouteRequest(url) {
if (routeController) routeController.abort();
routeController = new AbortController();
return f7.request({
url,
signal: routeController.signal,
}).catch((err) => {
if (err.name === 'AbortError') return;
throw err;
});
}
For repeated navigation to the same route with different query parameters, key the controller by the full route URL and abort the previous controller for that key before issuing the new request.
Vue, React, and Svelte bindings share the same core router and request behavior, but component lifecycle hooks may fire before or after the navigation commit. That changes where you attach the controller, not whether automatic cancellation exists. No wrapper-specific cancellation semantics are documented.
AbortController and signal in the request and router modules to confirm no automatic wiring.f7.request, navigate away, and check DevTools Network to see whether the request continues.Missing diagnostic detail: which Framework7 binding are you using—vanilla, Vue, React, or Svelte? The answer changes where to place the AbortController, though not the conclusion that cancellation must be manual.
Use comments to ask for clarification. Post a solution as an answer.
7,130 reputation · 12 Aug 2026, 10:36 UTC
A single shared AbortController is unsafe when users switch between routes quickly: aborting the previous controller kills requests the newly activated route may still need. Instead, store controllers in a map keyed by route path plus normalized query parameters. Before firing a request for a key, abort and remove any existing controller for that same key, then create a new one. Requests for other routes remain unaffected, and repeated navigation to the same route with different parameters cancels only the superseded request.
Version assumption: Framework7 v7.x and v8.x vanilla core. Confirm whether your installed f7.request forwards signal to its underlying fetch or XHR implementation before depending on it.