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

prevent DefaultValue from being set when the localStorage state does not contain the key. Fixes #26 #36

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

bartvanremortele
Copy link

This fixes #26

) {
delete state[node.key]
if (state.hasOwnProperty(node.key)) delete state[node.key]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like these two construction are the same:

if (a && b) {
}

and

if (a) {
   if (b) {
   }
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are not the same. If the state does not contain the node.key it will still persist the DefaultValue object because then it will fall in the else branch.

@polemius polemius force-pushed the master branch 2 times, most recently from 050c87f to 2f70d34 Compare May 17, 2023 06:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reseting atom causes key to be empty instead of default value
2 participants