Skip to content

Commit d96fc5d

Browse files
committed
Make diagrams larger on mobile
1 parent a4b0589 commit d96fc5d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

data/posts/split-route-modules.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,15 @@ Unfortunately, because these exports are both contained within the same module,
4242

4343
To visualize this as a timeline:
4444

45-
<img alt="Waterfall diagram showing 'Click /route' triggering 'Get route module' (split into 'clientLoader' and 'Component' segments) followed by 'Run clientLoader' before 'Render content' occurs" src="/blog-images/posts/split-route-modules/get-route-module.png" class="m-auto w-4/5 border rounded-md shadow" />
45+
<img alt="Waterfall diagram showing 'Click /route' triggering 'Get route module' (split into 'clientLoader' and 'Component' segments) followed by 'Run clientLoader' before 'Render content' occurs" src="/blog-images/posts/split-route-modules/get-route-module.png" class="m-auto sm:w-4/5 border rounded-md shadow" />
4646

4747
Note that, while the route module is a single request from the browser, in this diagram we’re showing how it’s made up of multiple logical units — in this case, `clientLoader` and `Component`.
4848

4949
The `clientLoader` is delayed from calling the external API since it has to wait for the hypothetical `MassiveComponent` to download. Since we can't render the component without the data from the client loader, the user has to wait for this network waterfall to complete before the page is rendered.
5050

5151
Ideally we’d like to be able to download the `clientLoader` export independently and run it as soon as it’s available:
5252

53-
<img alt="Waterfall diagram showing 'Click /route' triggering a parallel 'Get clientLoader' and 'Get Component' followed by 'Run clientLoader' before 'Render content' occurs, now earlier than before" src="/blog-images/posts/split-route-modules/get-route-module-split.png" class="m-auto w-4/5 border rounded-md shadow" />
53+
<img alt="Waterfall diagram showing 'Click /route' triggering a parallel 'Get clientLoader' and 'Get Component' followed by 'Run clientLoader' before 'Render content' occurs, now earlier than before" src="/blog-images/posts/split-route-modules/get-route-module-split.png" class="m-auto sm:w-4/5 border rounded-md shadow" />
5454

5555
At a framework level, the easiest way for us to solve this would be to force you to author your route in multiple files (`route/clientLoader.ts`, `route/component.tsx`, etc.) — but we really didn't want to give up on the convenience of the Route Module API. The question is, how do we achieve this?
5656

@@ -84,11 +84,11 @@ Since these exports have now been split into separate modules, the React Router
8484

8585
This optimization is even more pronounced when using additional parts of the Route Module API. For example, when using `clientLoader`, `clientAction` and `HydrateFallback`, the timeline for a single route module during a client-side navigation might look like this:
8686

87-
<img alt="Waterfall diagram showing 'Click /route' triggering 'Get route module' (split into 'clientLoader', 'clientAction', 'Component' and 'HydrateFallback' segments) followed by 'Run clientLoader' before 'Render content' occurs" src="/blog-images/posts/split-route-modules/get-big-route-module.png" class="m-auto w-4/5 border rounded-md shadow" />
87+
<img alt="Waterfall diagram showing 'Click /route' triggering 'Get route module' (split into 'clientLoader', 'clientAction', 'Component' and 'HydrateFallback' segments) followed by 'Run clientLoader' before 'Render content' occurs" src="/blog-images/posts/split-route-modules/get-big-route-module.png" class="m-auto sm:w-4/5 border rounded-md shadow" />
8888

8989
This would instead be optimized to the following:
9090

91-
<img alt="Waterfall diagram showing 'Click /route' triggering a parallel 'Get clientLoader', 'Get clientAction' and 'Get Component' (with 'HydrateFallback' being skipped) followed by 'Run clientLoader' before 'Render content' occurs, now earlier than before" src="/blog-images/posts/split-route-modules/get-big-route-module-split.png" class="m-auto w-4/5 border rounded-md shadow" />
91+
<img alt="Waterfall diagram showing 'Click /route' triggering a parallel 'Get clientLoader', 'Get clientAction' and 'Get Component' (with 'HydrateFallback' being skipped) followed by 'Run clientLoader' before 'Render content' occurs, now earlier than before" src="/blog-images/posts/split-route-modules/get-big-route-module-split.png" class="m-auto sm:w-4/5 border rounded-md shadow" />
9292

9393
This looks much better! As before, the client loader doesn't need to wait for the component to download, and now it doesn't need to wait for the `clientAction` or `HydrateFallback` exports to download either. In fact, it doesn't even need to download the `HydrateFallback` export at all during client navigations since it's only ever used on the initial page load.
9494

0 commit comments

Comments
 (0)