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

Set ReactionContext's self to DeepReadonly to prevent misuse that will break the deepEqual comparison later #93

Open
Kelerchian opened this issue Jan 30, 2024 · 0 comments

Comments

@Kelerchian
Copy link
Contributor

Kelerchian commented Jan 30, 2024

  • In a reaction, old value is exposed as a non-readonly type
  • Non-readonly type allows a reaction code to misuse the old value;
  • One example of misuse is assigning the old value to a new value
  • As a result, when doing a comparison between a stored old state and a new one, e.g. newState.someprop == oldState.someprop, it will return true newState.someprop has the same reference as oldState.

====

Should this be solved with a programmatic approach: setting the type to Readonly?
Or, should this be solved with a "user manual" approach e.g. by providing FAQs, guide, etc?

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

When branches are created from issues, their pull requests are automatically linked.

1 participant