Load functions data routes lazily #144
Replies: 1 comment
-
Parallelizing the data fetching and not lazy loading them is sort of the point of them. I wonder if it is just better to not use the data functions in this case and leverage context. I guess in theory there could be small gains still in parallelizing with loading them on demand. It's just at that point this adds a reasonable amount of complexity, because it needs to play into the reactive system, since Solid is synchronous and non-blocking. So we almost need to treat them as Resources at that point. I'd make the argument there that it would be better for us not to make assumptions to just lazy load the stuff yourself inside of the data functions. You mention that being cumbersome but I'd be tempted to build an abstraction over that in some way. |
Beta Was this translation helpful? Give feedback.
-
Hello.
I have an app where the lazy-loading of routes is making a great job in code splitting.
However, the moment I wanted to introduce data functions all that effort went through the window. The reason is that data functions are loaded upfront and therefore all the libraries they may use are also bundled with the main app, which in my case is huge. I was wondering if it would be possible to make them be asynchronously loaded, just like routes themselves are.
Of course I can lazy load the dependencies within the data functions, but that doesn't scale very well and gets cumbersome quickly.
What do you think? Is this a feature you would like to support?
Beta Was this translation helpful? Give feedback.
All reactions