isEqual returns true for objects with different keys when a value is undefined, and for {} vs []
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 25/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- react, typescript
- 領域
- frontend
調査の方向性
The bug is in the object branch of src/isEqual.ts, which compares key counts and then recurses only over the keys of a. Read that branch first, and check how it handles array versus object inputs and keys missing from b. Pull request #830 is already open against this issue, so review it before starting new work. Done means the five calls in the repro script return false, and the existing isEqual tests still pass.
索引モデルが issue の本文から書いたものです。
説明
isEqual returns true for objects with different keys when one has an undefined value, and when comparing an object with an array.
// npm i @rc-component/[email protected]
const isEqual = require("@rc-component/util/lib/isEqual").default;
console.log(isEqual({ a: undefined }, { b: 1 })); // true
console.log(isEqual({ a: 1, b: undefined }, { a: 1, c: 2 })); // true
console.log(isEqual({}, [])); // true
console.log(isEqual({ 0: 1 }, [1])); // true
console.log(isEqual([1], { 0: 1 })); // false
Command: node repro.cjs
Actual output:
true
true
true
true
false
Expected output: false for all five calls.
In src/isEqual.ts, the object branch compares Object.keys(a).length !== Object.keys(b).length and then checks deepEqual(a[key], b[key]) only for the keys of a, without checking Array.isArray(b) or Object.prototype.hasOwnProperty.call(b, key).
Version: @rc-component/[email protected] and master (149b6c2585), tested on Node v26.13.0. (Separate from #816.)
Credit: https://ucsbplse.github.io/
- 主要言語
- TypeScript
- スター
- 671
- フォーク
- 214
- 平均マージ
- 2日 1時間
- マージ済み PR(30日)
- 1
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
react-component/util のほかの issue
-
isEqual: false 'circular references' warning for a reference repeated across sibling keys対応中かも @savkaoleg が 79 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
react-component/util#816 ·
-
injectCSS method not attaching csp nonce passed to it. it is used in antd components internallyオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
react-component/util#671 · コメント 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
react-component/util#738 · コメント 1 件 · リアクション 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
react-component/util#710 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 25/100
react-component/util#647 · コメント 5 件 ·
react-component/util の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
Inbox: permission prompt (perm:) sessions appear as duplicate agents in the recipient picker and participants対応中かも @Djiit が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
backnotprop/plannotator#4517 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
MoonshotAI/kimi-code#6000 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
OpenSlides/openslides-client#6768 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 1/5 1〜3時間 初心者へのやさしさ 90/100
modelcontextprotocol/modelcontextprotocol#3622 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信