You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ah, poop, well that's a dumb mistake 😅 . Thanks for catching this and filing the issue @Venryx !
You probably meant this instead:
if (jsonify == null) { jsonify = true } // default to true like mobx-persist
Actually, I meant undefined, since if jsonify is not specified, it'll be undefined, not null. So that would look like:
if(typeofjsonify==='undefined'){jsonify=true}// default to true like mobx-persist
At some point I just had jsonify = true as a default arg in the destructuring, and then once I wrote the somewhat complex (and later even more in #15) defaults logic for the storage config, I thought it would make sense to do all defaults outside of destructuring. That clearly invited some bugs 😖 .
=== undefined is meant to replicate how default args work, but I think I'll just make it a default arg instead to fix as I'm already using one for Transforms anyway and, as I found out during its implementation, default args make for better typings too.
The code in
index.js
has a bug: https://github.com/agilgur5/mst-persist/blob/master/src/index.tsLook closely at the highlighted usages:
Note this line:
And note that there is no line after that which sets the jsonify variable's value.
Basically, the line above forces jsonify to always be
true
, even if the user explicitly sets it tofalse
.You probably meant this instead:
The text was updated successfully, but these errors were encountered: