-
-
Notifications
You must be signed in to change notification settings - Fork 4
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
Prefetch async route components #255
Conversation
✅ Deploy Preview for kitbag-router ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very clean solution, great feature 👏
return new Promise(resolve => { | ||
loaded = true | ||
resolve({ default: { template: '' } }) | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clever!
const props = withDefaults(defineProps<RouterLinkProps & RouterPushOptions>(), { | ||
// because prefetch can be a boolean vue automatically sets the default to false. | ||
// Specifically setting the default to undefined | ||
prefetch: undefined, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
boo macros 👎
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general I really like how vue defaults booleans to false. But it can cause some surprising errors when you're not really expecting it.
Description
Adds a new feature where if a route is defined with an async component (by using vue's
defineAsyncComponent
utility) that component will be prefetched into the app when arouter-link
to that route is mounted.