react-router icon indicating copy to clipboard operation
react-router copied to clipboard

🗺️ Split out client loaders/actions

Open ryanflorence opened this issue 1 year ago • 3 comments

PR: https://github.com/remix-run/react-router/pull/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 ^

ryanflorence avatar Jan 29 '24 17:01 ryanflorence

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

mbsyaswanth avatar May 12 '24 07:05 mbsyaswanth

@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.

sergiodxa avatar May 12 '24 07:05 sergiodxa

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

bluefire2121 avatar May 18 '24 14:05 bluefire2121