Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
2 tasks
ryanflorence opened this issue Jan 29, 2024 · 3 comments
Closed
2 tasks
Assignees

Comments

@ryanflorence
Copy link
Member

ryanflorence commented Jan 29, 2024

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.

@mbsyaswanth
Copy link

This is one that that makes remix remix. Why do we want to split them out ?

@sergiodxa
Copy link
Member

@mbsyaswanth the idea is to split the clientLoader and clientAction code from the route code, no to remove them from Remix itself

This is the Roadmap Planning video where it was discussed and explained https://www.youtube.com/live/7kdulqXtPII?t=2570&si=v8Xhz62QJFSVF0Rg.

@bluefire2121
Copy link

@mbsyaswanth like @sergiodxa said. It's not going anywhere. Today they run in series. Tomorrow they'll run in parallel. Faster renders.

@ryanflorence ryanflorence transferred this issue from remix-run/remix May 20, 2024
@markdalgleish markdalgleish moved this from Planned to In Progress in Roadmap May 23, 2024
@ryanflorence ryanflorence moved this from In Progress to Planned in Roadmap May 28, 2024
@ryanflorence ryanflorence moved this from Planned to In Progress in Roadmap Jan 6, 2025
@ryanflorence ryanflorence changed the title 🗺️ Split out client loaders/actions 🗺️ Route Module Chunks (client loaders/actions) Jan 6, 2025
@ryanflorence ryanflorence modified the milestones: v7.1.0, v7.2.0 Jan 6, 2025
@markdalgleish markdalgleish changed the title 🗺️ Route Module Chunks (client loaders/actions) 🗺️ Route Module Chunks (client loaders/actions/HydrateFallback) Jan 13, 2025
@ryanflorence ryanflorence changed the title 🗺️ Route Module Chunks (client loaders/actions/HydrateFallback) 🗺️ Split Route Modules (client loaders/actions/HydrateFallback) Jan 21, 2025
@ryanflorence ryanflorence removed this from the v7.3.0 milestone Mar 3, 2025
@ryanflorence ryanflorence moved this from In Progress to Merged/Done in Roadmap Mar 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

5 participants