Actyx / Actyx/machines

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

Open
#93 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
8
Forks
2
PR merge metrics
No merged PRs in 30d

Description

- 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?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.