applyPatches produces same result, but should it also preserve identity?
メンテナーはふだん 4 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 25/100
- issue の種類
- 機能追加
- 明瞭さ
- 説明が足りない
- 活発さ
- 停滞
- 技術スタック
- javascript
- 領域
- frontend
調査の方向性
リンクされているCodeSandboxの再現から始め、unshiftの例についてproduceとapplyPatchesのアイデンティティの挙動を比較します。itemsに対して生成されるreplaceおよびadd操作を確認し、オブジェクトのアイデンティティを保持することと、移動されたインデックスに関する十分な情報を提供することが意図された要件かどうかを明らかにします。文書化された決定、または合意された実装範囲が確定すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
🙋♂ Question
Consider the following code:
https://codesandbox.io/s/immer-sandbox-forked-t7ghd9?file=/src/index.ts
While patchedState is indeed deep equal to producedState, there is a difference in that produce preserves object identity, but applyPatches does not.
Is this a property that would be useful? I arrived at this during a different route, which may be my real question: when an unshift happens, instead of an add op for path ["items", 0], which I expected, instead the patches include a replace op for the first two items in the array, and then an add op for position ["items", 2]. Applying these patches will result in object identity being broken.
I am experimenting with using Immer for change tracking, and this makes life more complicated: I want to track whether I need to update paths if their indices have shifted, but I don't get sufficient information from the patch to determine that.
Link to repro
https://codesandbox.io/s/immer-sandbox-forked-t7ghd9?file=/src/index.ts
Environment
We only accept questions against the latest Immer version.
- Immer version: 9.0.12
- Occurs with
setUseProxies(true) - Occurs with
setUseProxies(false)(ES5 only)
- 主要言語
- JavaScript
- スター
- 29k
- フォーク
- 905
- 平均マージ
- 3日 16時間
- マージ済み PR(30日)
- 22
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
immerjs/immer のほかの issue
-
Shrinking an array with `length =` and growing it back loses the patches for the truncated indices対応中かも @RClaudiuM が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 4 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
メンテナーはふだん 4 日以内に返信
-
Docs: Chinese (zh-CN) website translation is outdated vs English docs再び着手できるかも @lijiayou0728 が 91 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
immerjs/immer#1242 · コメント 5 件 ·
メンテナーはふだん 4 日以内に返信
-
question
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
メンテナーはふだん 4 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
immerjs/immer#1217 · コメント 1 件 ·
メンテナーはふだん 4 日以内に返信
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
Automattic/node-canvas#2633 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
capricorn86/happy-dom#2594 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
microsoft/monaco-editor#5575 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信