-
-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Preload implementation #101
Comments
First of all, i think it is a very nice plan. I remember that prefetch was able to operate If I remember correctly, just because the html file is referred to as prefetch does not And this router components are basically does not use code splitting. Of coursely, The method of using code spliting and dynamic import is Even with the above methods, preload will be greatly influenced by Bundler. If README.md should describe how prefetch is applied to https://github.com/hmmhmmhm/svelte-spa-template/blob/master/postbuild.ts#L52 |
Hey @ramiroaisen thanks for this suggestion. Would you be able to create a sample API to demonstrate this? That is: a sample of what kind of code you'd like to be able to write (not asking you to implement this, but just to show me what would be possible with it :) ) Is this just for asynchronous loading of routes like @hmmhmmhm describes? |
This should be fixed by #73 in branch 3.0. Closing |
i! very nice project,
I have an idea, that i will implement in a fork of this, but if your ok with it i'll make a PR.
The idea is that each component could export a preload function just like in sapper and then the router would first call preload to get the initial props
If its a promise the router will wait for it to resolve and then pass the props to the component instance
if the component doesnt export a preload function then the current behaviour is followed.
This way if components need to make extra fetch calls or something like that they dont have yo make a "loading" screen... or just blank screens between navigation
Also if this is implemented the router could prefetch preload calls in events like hovering over links and so like in sapper with <a href"#my-link' rel="prefetch"> or html
Tell me your thogths about that, and if you point me in the right direccion of where you think i can add this to your code i'll be pleased.
The text was updated successfully, but these errors were encountered: