File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
packages/react-router/lib/router Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -4868,10 +4868,15 @@ async function loadLazyRouteModule(
4868
4868
return ;
4869
4869
}
4870
4870
4871
+ // We use `.then` to chain additional logic to the lazy route promise so that
4872
+ // the consumer's lazy route logic is coupled to our logic for updating the
4873
+ // route in place in a single task. This ensures that the cached promise
4874
+ // contains all logic for managing the lazy route. This chained promise is
4875
+ // then awaited so that consumers of this function see the updated route.
4871
4876
let lazyRoutePromise = route . lazy ( ) . then ( ( lazyRoute ) => {
4872
- // Update the route in place. This should be safe because there's no way
4873
- // we could yet be sitting on this route as we can't get there without
4874
- // resolving lazy() first.
4877
+ // Here we update the route in place. This should be safe because there's
4878
+ // no way we could yet be sitting on this route as we can't get there
4879
+ // without resolving lazy() first.
4875
4880
//
4876
4881
// This is different than the HMR "update" use-case where we may actively be
4877
4882
// on the route being updated. The main concern boils down to "does this
You can’t perform that action at this time.
0 commit comments