Set `ReactionContext`'s self to DeepReadonly to prevent misuse that will break the `deepEqual` comparison later
- 主要言語
- 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
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 25/100