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

getState & restoreState do not consistently deep copy. #111

Open
milescrawford opened this issue Feb 8, 2022 · 0 comments
Open

getState & restoreState do not consistently deep copy. #111

milescrawford opened this issue Feb 8, 2022 · 0 comments

Comments

@milescrawford
Copy link

getState's documentation says that it makes a deep copy, but restoreState does not make a copy when you pass this back in.

So, if you store a state, restore a board to that state, and modify the board, your stored state is mutated. This makes it very difficult to maintain a history, or keep a permanently-stored state that you revert to more than once.

See this JS fiddle for an example: https://jsfiddle.net/czjxue6y/4/

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

No branches or pull requests

1 participant