-
Notifications
You must be signed in to change notification settings - Fork 220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: isDeepEqual util #9642
base: feat/growi-ai-next
Are you sure you want to change the base?
fix: isDeepEqual util #9642
Conversation
|
apps/app/src/utils/is-deep-equal.ts
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isDeepEquals は @growi/core に移していて、移す前のコードを消し忘れていたので削除
@@ -10,6 +10,10 @@ export const isDeepEquals = <T extends object>(obj1: T, obj2: T): boolean => { | |||
const val1 = obj1[key]; | |||
const val2 = obj2[key]; | |||
|
|||
if (isShallow) { | |||
return val1 === val2; | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isShallow
オプションを追加して浅い階層の比較のみをできるようにした- 旧 isDeepEqual を参考
growi/packages/editor/src/client/stores/codemirror-editor.ts
Lines 15 to 19 in 3d297a2
const isDeepEquals = <T extends object>(obj1: T, obj2: T): boolean => { | |
const typedKeys = Object.keys(obj1) as (keyof typeof obj1)[]; | |
return typedKeys.every(key => obj1[key] === obj2[key]); | |
}; | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isDeepEquals という名前のメソッドなのに isShallow オプションを実装するのは変
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isRecursively オプションに変更しました
@@ -10,6 +10,10 @@ export const isDeepEquals = <T extends object>(obj1: T, obj2: T): boolean => { | |||
const val1 = obj1[key]; | |||
const val2 = obj2[key]; | |||
|
|||
if (isShallow) { | |||
return val1 === val2; | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isDeepEquals という名前のメソッドなのに isShallow オプションを実装するのは変
Task