Actyx / Actyx/machines

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

未关闭
#93 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
TypeScript
星标
8
派生
2
PR 合并指标
30 天内没有已合并 PR

描述

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

贡献指南

这个仓库没有索引到贡献指南

调研方向

No files or tests are named. Start by locating ReactionContext and the deepEqual comparison, then determine how the old reaction value is typed and where assigning it can preserve references. Done means the chosen approach prevents this misuse and verifies that old and new state comparisons remain correct.

由索引模型根据 Issue 内容生成。

评估

技术栈
typescript
领域
backend-api-design
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。