-
-
Notifications
You must be signed in to change notification settings - Fork 926
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
Rename preload method to load in lazy #1726
Comments
IMO the naming is actually good as it reminds me of image preloading, see https://web.dev/preload-responsive-images/. If I understand the API correctly (not documented!) |
No, there is no preloading mechanism in lazy loading, that is why it is called lazy loading and that is exactly why it is misleading which you prove it unknowingly :) |
I don't understand what you mean by "there is no preloading mechanism". I can call I also understand that the action itself is indeed to "load" the component. I just wanted to voice my preference for keeping it I admit I don't have much experience with it in SolidStart and how it interacts with SSR. |
What I meant by "there is no preloading mechanism" is that there is no preloading mechanism akin to image preloads. The functionality of the lazy function is all about module loading, https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import, i think it is best to keep the terminology close to the underlying mechanism and the general use of the concepts. Modules are always meant to be loaded. The action is loading, not doing something in advance. Pre would be a good fit if the function controls a setting that triggers the loading mechanism. Its use is not limited to components, you can lazy load any JavaScript module.
I believe it is best if there is less room for assumptions and associations. So, the name "load" in my mind bring it closer to what it does while preload shifts the balance towards prefetching and calls mental association with all the browser API that is prefixed with the word pre. "load" is also good for documentation because now a single line like "It loads the module" is enough. We should actively dissociate from the word pre because of all the connotations. From the SSR perspective, a lazy loaded module is not any different than other async values. |
I understand that perspective as well, thank you for writing it out. 👍🏻 |
The thing is The only visual difference here is that a non-preloaded lazy component would have to go through the fallback process (Suspense). |
Yeah I see the argument for both sides, but components purpose is to be lazily loaded on render. I know we could argue it either way. But generally loading it before render is preloading in this case which isn't enough for a breaking API change. Since this is going nowhere I'm doing some cleanup and closing. |
solid/packages/solid/src/render/component.ts
Line 316 in 1593dd6
The name
preload
implies something that happens beforehand and does not describe the action it carries out.load
would be a more accurate name for it.The text was updated successfully, but these errors were encountered: