Skip to content

🗺️ Split Route Modules (client loaders/actions/HydrateFallback) #11571

@ryanflorence

Description

@ryanflorence
Planning Notes
  • Mark thinks we'll have something to play with this week (JAN 13th)
  • Lots of opportunities for bugs so we'd love a lot of people trying it out when it's unstable in real apps (though not in production, ofc)
  • Ryan to goof around with it
  • Matt to check out the runtime code

PR: #11871

When a link to a route with a client loader is clicked the browser has to first fetch the JS module for the route before it can call the client loader.

If a client loader is small, and the component is large, this slows down the transition because the loader is blocked by the size of the component.

get module:      |---------------|
call loader:                     |--------|
                                   render ^

By splitting out the clientLoader to its own bundle we can do these in parallel:

get component:   |-----------|
get loader:      |----|
call loader:          |--------|
                        render ^

Also, HydrateFallback is only used for the route that was rendered on initial page load. If we're splitting route modules into chunks, we can also create a separate HydrateFallback chunk which is only used on the initial page load and then skipped for any client-side navigations.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Stage 5 - Stable

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions