-
Notifications
You must be signed in to change notification settings - Fork 100
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
feat: allow ssrRef
to work outside of setup
#46
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/nuxt-community/composition-api/c9na82xy3 |
Would value your thoughts @mathe42. Do we lose anything by doing it this way? |
Yes we can not track deep changes. |
@mathe42 Yes, of course. Good catch. Thoughts on amended proxy approach? |
This will break IE11 |
I think we can add a option to use Proxies and fallback to the onServerPrefetch stuff. Outside Setup when Proxies allowed use it else always send state to client... |
The proxy code won't be in the client bundle; it's just server-side.
It should only send state after something is assigned to the proxy. So // This shouldn't be sent
const a = ssrRef('init')
// But this now will be
a.value = 'init' |
Nice 👍 Does this mean we need Node Version >= x? => change package.json |
Node >= 6.0 https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy But nuxt needs later versions: https://github.com/nuxt/nuxt.js/blob/dev/distributions/nuxt/package.json |
This PR removes the custom prefetching we were doing (via redefinition of
onServerPrefetch
, and instead uses a transparent proxy for thessrRef
on server-side to update the state every time it is changed.see #40