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: properly serialize undefined in vuex store #3913
Conversation
Codecov Report
@@ Coverage Diff @@
## dev #3913 +/- ##
==========================================
- Coverage 97.56% 97.48% -0.09%
==========================================
Files 18 18
Lines 1232 1232
Branches 337 337
==========================================
- Hits 1202 1201 -1
- Misses 29 30 +1
Partials 1 1
Continue to review full report at Codecov.
|
Thanks for you effort @aldarund If
|
We should also keep in mind that |
@manniL i did replaced serialize-javascript everywhere where it was used for json. As i see in other places it is used for javascript serialization ( at least calls to serialize-javascript dont have isJson argument) so it probably cant be replaced entirely |
Could you fix conflicts @aldarund ? |
conflicts fixed |
# Conflicts: # package.json # yarn.lock
Waiting to CI passing :) |
Hey the new option kills all methods (like formatters for tables) when serializing. That’s intended right? |
@appinteractive not quite follow. What u do mean by methods? Functions? If functions they were killed before as well |
Getting isues with this now. ✖ error NuxtServerError: Cannot stringify a function |
@benfavre can you provide us your state? Likely there is a function inside |
@benfavre According to the source code messages should never be a function, only an object 🤔 |
This is because I use the Lazy option. |
Weird. Could you open up a new issue with reproduction as request (here)? Let's continue the discussion there. |
https://cmty.app forces a repro link ... randomly pasted jsfiddle (probably going to get many of theses) |
I think this should have been a breaking change, I rolled back to (Just a heads up, I'm not complaining, thanks for the awesome work!) Repro is basically this: https://github.com/Rich-Harris/devalue/blob/d73708c51f70bf9b962103976b44e782b1e3a068/test/test.ts#L89-L93 , putting I know what I'm doing is weird and I would totally understand if nuxt doesn't want to support that kind of hacks. I'm storing stuff that I only need server-side and stuff that I only need client-side. These are complex values and it works well as long as I put them in the store and retrieve them on the same side. Before |
@vhf We are working on replacing the error with "just" a warning to revert the breaking change. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Types of changes
Description
Resolves #3825
serialize-javascript dont serialize undefined values.
yahoo/serialize-javascript#35
This PR use https://github.com/Rich-Harris/devalue for json serialization instead. JSON.stringify not used to avoid XSS
Checklist: