-
Notifications
You must be signed in to change notification settings - Fork 84
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
Option to preload scripts but not render component. #515
Comments
I could create a small plugin to handle this. Main question is the syntax since we have the following variables:
Gotta run now, but will have a look at this when I get back. |
There's a new prefetch feature that might solve this. <header data-routify-prefetch-data="hover">
<a href="/some/where/1">1</a>
<a href="/some/where/2">2</a>
</header> The documentation is in the pipeline. Let me know if this works for you. 🙂 |
I couldn't get this to work. I'm on 2.18.12 and tried putting it on a container element and the link itself. Do I need to be using a pre-release or doing something else to enable this? |
@kevincox the new feature is for Routify 3. |
Ah, of course. I'll need to try updating at some point. |
Is your feature request related to a problem? Please describe.
I have some components that can't be fully per-rendered for various reasons. Maybe they show pop-up notifications or the amount of data that they fetch is too high for preloading. I would like an option to preload the route but not render the actual component.
This can be particularly helpful when rendering a long list of the same type of things, but the user is likely to click only one. You can load the
/orders/[id]
route but avoid fetching the data for any (or all) of the actual orders.Describe the solution you'd like
An option to preload the route but not mount it. I can see a few ways to provide this.
Maybe the component itself could declare that it isn't suitable for pre-rendering.
Or maybe the
preload
helper could take a parameter such aspreload("/user/[name]", {instantiate: false})
.Describe alternatives you've considered
preload("/orders/0")
. This is easier to write than 2 but is wasteful as the loaded data is useless and may cause confusing errors due to background requests for invalid IDs.The text was updated successfully, but these errors were encountered: