@remix-run/router 0.0.0-experimental-edf416237 → 0.0.0-experimental-e157216e3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export type { ActionFunction, ActionFunctionArgs, AgnosticDataIndexRouteObject, AgnosticDataNonIndexRouteObject, AgnosticDataRouteMatch, AgnosticDataRouteObject, AgnosticIndexRouteObject, AgnosticNonIndexRouteObject, AgnosticRouteMatch, AgnosticRouteObject, DataStrategyFunction as unstable_DataStrategyFunction, DataStrategyFunctionArgs as unstable_DataStrategyFunctionArgs, DataStrategyMatch as unstable_DataStrategyMatch, ErrorResponse, FormEncType, FormMethod, HandlerResult as unstable_HandlerResult, HTMLFormMethod, JsonFunction, LazyRouteFunction, LoaderFunction, LoaderFunctionArgs, ParamParseKey, Params, PatchRoutesOnMissFunction as unstable_PatchRoutesOnMissFunction, PathMatch, PathParam, PathPattern, RedirectFunction, ShouldRevalidateFunction, ShouldRevalidateFunctionArgs, TrackedPromise, UIMatch, V7_FormMethod, } from "./utils";
1
+ export type { ActionFunction, ActionFunctionArgs, AgnosticDataIndexRouteObject, AgnosticDataNonIndexRouteObject, AgnosticDataRouteMatch, AgnosticDataRouteObject, AgnosticIndexRouteObject, AgnosticNonIndexRouteObject, AgnosticRouteMatch, AgnosticRouteObject, DataStrategyFunction as unstable_DataStrategyFunction, DataStrategyFunctionArgs as unstable_DataStrategyFunctionArgs, DataStrategyMatch as unstable_DataStrategyMatch, ErrorResponse, FormEncType, FormMethod, HandlerResult as unstable_HandlerResult, HTMLFormMethod, JsonFunction, LazyRouteFunction, LoaderFunction, LoaderFunctionArgs, ParamParseKey, Params, AgnosticPatchRoutesOnMissFunction as unstable_AgnosticPatchRoutesOnMissFunction, PathMatch, PathParam, PathPattern, RedirectFunction, ShouldRevalidateFunction, ShouldRevalidateFunctionArgs, TrackedPromise, UIMatch, V7_FormMethod, } from "./utils";
2
2
  export { AbortedDeferredError, defer, generatePath, getToPathname, isRouteErrorResponse, joinPaths, json, matchPath, matchRoutes, normalizePathname, redirect, redirectDocument, resolvePath, resolveTo, stripBasename, } from "./utils";
3
3
  export type { BrowserHistory, BrowserHistoryOptions, HashHistory, HashHistoryOptions, History, InitialEntry, Location, MemoryHistory, MemoryHistoryOptions, Path, To, } from "./history";
4
4
  export { Action, createBrowserHistory, createHashHistory, createMemoryHistory, createPath, parsePath, } from "./history";
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/router v0.0.0-experimental-edf416237
2
+ * @remix-run/router v0.0.0-experimental-e157216e3
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1714,7 +1714,7 @@ function createRouter(init) {
1714
1714
  let initialScrollRestored = init.hydrationData != null;
1715
1715
  let initialMatches = matchRoutes(dataRoutes, init.history.location, basename);
1716
1716
  let initialErrors = null;
1717
- if (initialMatches == null) {
1717
+ if (initialMatches == null && !patchRoutesOnMissImpl) {
1718
1718
  // If we do not match a user-provided-route, fall back to the root
1719
1719
  // to allow the error boundary to take over
1720
1720
  let error = getInternalRouterError(404, {
@@ -1730,13 +1730,15 @@ function createRouter(init) {
1730
1730
  };
1731
1731
  }
1732
1732
  let initialized;
1733
- let hasLazyRoutes = initialMatches.some(m => m.route.lazy);
1734
- let hasLoaders = initialMatches.some(m => m.route.loader);
1735
- if (hasLazyRoutes) {
1733
+ if (!initialMatches) {
1734
+ // We need to run patchRoutesOnMiss in initialize()
1735
+ initialized = false;
1736
+ initialMatches = [];
1737
+ } else if (initialMatches.some(m => m.route.lazy)) {
1736
1738
  // All initialMatches need to be loaded before we're ready. If we have lazy
1737
1739
  // functions around still then we'll need to run them in initialize()
1738
1740
  initialized = false;
1739
- } else if (!hasLoaders) {
1741
+ } else if (!initialMatches.some(m => m.route.loader)) {
1740
1742
  // If we've got no loaders to run, then we're good to go
1741
1743
  initialized = true;
1742
1744
  } else if (future.v7_partialHydration) {