Skip to content
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

fix: ssrRef crashes with nested frozen object #598

Open
pleinon opened this issue Jan 18, 2022 · 1 comment
Open

fix: ssrRef crashes with nested frozen object #598

pleinon opened this issue Jan 18, 2022 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@pleinon
Copy link

pleinon commented Jan 18, 2022

🐛 The bug
I am using Apollo Client which returns response data as frozen (Object.freeze()) on development mode. Looks like this causes ssrRef.value mutation to crash when frozen data has nested objects:

'get' on proxy: property 'nested' is a read-only and non-configurable data property on the proxy target but the proxy did not return its actual value (expected '#<Object>' but got '[object Object]')

🛠️ To reproduce
Steps to reproduce the behavior:

const crashTest = ssrRef<any | null>(null)
crashTest.value = Object.freeze({
  test: 'works',
  nested: {}, // crash
})

🌈 Expected behaviour
ssrRef should be able to handle frozen complex objects.

ℹ️ Additional context
Sample is greatly simplified from my Pinia-state. Crashing code is executed in store during server side useFetch.

@pleinon pleinon added the bug Something isn't working label Jan 18, 2022
@pmrotule
Copy link

pmrotule commented May 5, 2022

We're experiencing the same issue and the only workaround we found was to deep-clone all results coming from ApolloClient which is pretty bad for performance. Would be great to have a proper fix 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants