@remix-run/router 0.0.0-experimental-3ba3024e → 0.0.0-experimental-2272fa73

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/router v0.0.0-experimental-3ba3024e
2
+ * @remix-run/router v0.0.0-experimental-2272fa73
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -4133,7 +4133,7 @@ async function loadLazyRouteModule(route, mapRouteProperties, manifest) {
4133
4133
 
4134
4134
  // Default implementation of `dataStrategy` which fetches all loaders in parallel
4135
4135
  function defaultDataStrategy(opts) {
4136
- return Promise.all(opts.matches.map(m => m.bikeshed_loadRoute()));
4136
+ return Promise.all(opts.matches.map(m => m.resolve()));
4137
4137
  }
4138
4138
  async function callDataStrategyImpl(dataStrategyImpl, type, request, matchesToLoad, matches, manifest, mapRouteProperties, requestContext) {
4139
4139
  let routeIdsToLoad = matchesToLoad.reduce((acc, m) => acc.add(m.route.id), new Set());
@@ -4144,14 +4144,14 @@ async function callDataStrategyImpl(dataStrategyImpl, type, request, matchesToLo
4144
4144
  // back out below.
4145
4145
  let results = await dataStrategyImpl({
4146
4146
  matches: matches.map(match => {
4147
- let bikeshed_load = routeIdsToLoad.has(match.route.id);
4148
- // `bikeshed_loadRoute` encapsulates the route.lazy, executing the
4147
+ let shouldLoad = routeIdsToLoad.has(match.route.id);
4148
+ // `resolve` encapsulates the route.lazy, executing the
4149
4149
  // loader/action, and mapping return values/thrown errors to a
4150
4150
  // HandlerResult. Users can pass a callback to take fine-grained control
4151
4151
  // over the execution of the loader/action
4152
- let bikeshed_loadRoute = handlerOverride => {
4152
+ let resolve = handlerOverride => {
4153
4153
  loadedMatches.add(match.route.id);
4154
- return bikeshed_load ? callLoaderOrAction(type, request, match, manifest, mapRouteProperties, handlerOverride, requestContext) :
4154
+ return shouldLoad ? callLoaderOrAction(type, request, match, manifest, mapRouteProperties, handlerOverride, requestContext) :
4155
4155
  // TODO: What's the best thing to do here - return an empty "success" result?
4156
4156
  // Or return a success result with the current route loader/action data?
4157
4157
  // We strip these results out if the route didn't need to be revalidated in
@@ -4163,8 +4163,8 @@ async function callDataStrategyImpl(dataStrategyImpl, type, request, matchesToLo
4163
4163
  });
4164
4164
  };
4165
4165
  return _extends({}, match, {
4166
- bikeshed_load,
4167
- bikeshed_loadRoute
4166
+ shouldLoad,
4167
+ resolve
4168
4168
  });
4169
4169
  }),
4170
4170
  request,
@@ -4175,7 +4175,7 @@ async function callDataStrategyImpl(dataStrategyImpl, type, request, matchesToLo
4175
4175
  // ensures a route is fully loaded
4176
4176
  // Throw if any loadRoute implementations not called since they are what
4177
4177
  // ensure a route is fully loaded
4178
- matches.forEach(m => invariant(loadedMatches.has(m.route.id), "`match.bikeshed_loadRoute()` was not called for route id \"" + m.route.id + "\". " + "You must call `match.bikeshed_loadRoute()` on every match passed to " + "`dataStrategy` to ensure all routes are properly loaded."));
4178
+ matches.forEach(m => invariant(loadedMatches.has(m.route.id), "`match.resolve()` was not called for route id \"" + m.route.id + "\". " + "You must call `match.resolve()` on every match passed to " + "`dataStrategy` to ensure all routes are properly loaded."));
4179
4179
 
4180
4180
  // Filter out any middleware-only matches for which we didn't need to run handlers
4181
4181
  return results.filter((_, i) => routeIdsToLoad.has(matches[i].route.id));