Pinia throws obj.hasOwnProperty is not a function when combined with apollo #2884
-
Reproductionhttps://github.com/kyurkchyan/pinia-apollo-pnpm Steps to reproduce the bug
Expected behaviorThe app should load successfully Actual behaviorApp load fails with Additional informationIf you switch to the without-pinia branch and try the same steps everything works You don't even have to use any pinia store for this issue to happen. As soon as you install the pinia nuxt plugin everything breaks. Further, if you downgrade the version of pinia to I've tried all of the versions that were released after |
Beta Was this translation helpful? Give feedback.
Replies: 22 comments 4 replies
-
Seems to be related with #2837 |
Beta Was this translation helpful? Give feedback.
-
Can you repro without Apollo? Where is an object with null as the prototype being passed to pinia? |
Beta Was this translation helpful? Give feedback.
-
@posva this only happens with the apollo project sample. I am not sure how else I can reproduce the issue |
Beta Was this translation helpful? Give feedback.
-
I have been able to reproduce it outside of Apollo project with the following
|
Beta Was this translation helpful? Give feedback.
-
Yes, and my goal is to understand why such an object in included in pinia state by Apollo. |
Beta Was this translation helpful? Give feedback.
-
I've investigated a bit and seems that's caused by how Apollo stores data in |
Beta Was this translation helpful? Give feedback.
-
Also found this issue in the apollo-client repo apollographql/apollo-client#12199 |
Beta Was this translation helpful? Give feedback.
-
having the same issue on my end, also using "@pinia/nuxt": "0.9.0" and "pinia": "2.3.0" + "@nuxtjs/apollo": "5.0.0-alpha.14 this was not the case with "@pinia/nuxt": "0.5.5" and "pinia": "2.2.5" |
Beta Was this translation helpful? Give feedback.
-
I'm also experiencing this obj.hasOwnProperty error with Nuxt 3.15 and @pinia/nuxt 0.9.0 together with NuxtJS/Apollo. It gives me 500 error. I have tried some approaches from other threads here like npm i pinia --force or installing with pnpm but nothing seems to work. Is there any tips to get this working ? |
Beta Was this translation helpful? Give feedback.
-
Same issue when i upgrade my project from to "@pinia/nuxt": "0.9.0", With "pinia": "^2.3.1", |
Beta Was this translation helpful? Give feedback.
-
adding vite : { alias: { works compiling in dev mode, but not in production compiling mode |
Beta Was this translation helpful? Give feedback.
-
Same issue with pinia 3 and nuxt pinia 0.10.0 `[nuxt] [request error] [unhandled] [500] obj.hasOwnProperty is not a function info: SERVER : Page loaded / }` |
Beta Was this translation helpful? Give feedback.
-
I had met the issue as well. I'm using the I found the error is throwed from the function named When I debug it, it shows that the I need to make the Maybe we should make the I will use |
Beta Was this translation helpful? Give feedback.
-
Had the same issue as well and rolling back "@pinia/nuxt": "0.5.5", fixed my problem for now. |
Beta Was this translation helpful? Give feedback.
-
same here.. are we stick to |
Beta Was this translation helpful? Give feedback.
-
From my investigations, the final problem now come from the way of apollo client to create objects. A PR was merged "recently" : apollographql/apollo-client#12402 |
Beta Was this translation helpful? Give feedback.
-
I have the same problem, and the version has been reverted to 0.5.5 to restore to normal
|
Beta Was this translation helpful? Give feedback.
-
I currently also get it in a project without apollo. |
Beta Was this translation helpful? Give feedback.
-
@kyurkchyan I can confirm the same behavior with @nuxt/pinia. I can also confirm that version 0.5.5 solved the problem. When can we expect the fix? This is stale topic. Thanks! |
Beta Was this translation helpful? Give feedback.
-
A solution is to use
|
Beta Was this translation helpful? Give feedback.
-
Hello, same problem here in a project that doesn't use apollo.
|
Beta Was this translation helpful? Give feedback.
-
FYI this was fixed in fd6d969 |
Beta Was this translation helpful? Give feedback.
Can you repro without Apollo? Where is an object with null as the prototype being passed to pinia?
#2867 Should fix this