Control lazy route discovery in Framework Mode with future.unstable_customRouteDiscovery
enabled. This allows you to imperatively discover routes as well as add custom behavior
when a manifest version mismatch is detected. Calling loadAllRoutes will load the entire
route manifest for the current (potentially stale) client version - this requires that prior
client artifacts are still available on your CDN and you have not made breaking changes to
the API contracts of your loaders and actions.
See the Route Discovery guide for more information and examples.
let { state, discoverRoutes, loadAllRoutes } = unstable_useRouteDiscovery({
onManifestMismatch: async (event) => {
// Eagerly load the complete route tree for this client without requiring a hard reload
await event.loadAllRoutes();
},
});
// Eagerly discover specific routes
discoverRoutes(["/a", "/b"]);
function useRouteDiscovery(options: RouteDiscoveryOptions = {})
An awaited manifest-mismatch handler.
The client version, full-manifest loading state, and discovery operations.