Skip to content
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

Open
wants to merge 4 commits into
base: feat/growi-ai-next
Choose a base branch
from

Conversation

miya
Copy link
Member

@miya miya commented Feb 10, 2025

Task

  • #161675 [GROWI AI Next][特化型アシスタント] エディターを開こうとすると Maximum call stack size exceeded というエラーが出てエディターが操作できない (161504 のデグレ)

@miya miya requested a review from yuki-takei February 10, 2025 10:57
@miya miya self-assigned this Feb 10, 2025
Copy link

changeset-bot bot commented Feb 10, 2025

⚠️ No Changeset found

Latest commit: 40ef622

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Member Author

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;
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • isShallow オプションを追加して浅い階層の比較のみをできるようにした
  • 旧 isDeepEqual を参考

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]);
};

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isDeepEquals という名前のメソッドなのに isShallow オプションを実装するのは変

Copy link
Member Author

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;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isDeepEquals という名前のメソッドなのに isShallow オプションを実装するのは変

@miya miya requested a review from yuki-takei February 10, 2025 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants