Skip to content

Fix issue with shallowEquals incorrectly returning too early#319

Open
ice1080 wants to merge 1 commit into
playcanvas:mainfrom
ice1080:main
Open

Fix issue with shallowEquals incorrectly returning too early#319
ice1080 wants to merge 1 commit into
playcanvas:mainfrom
ice1080:main

Conversation

@ice1080
Copy link
Copy Markdown

@ice1080 ice1080 commented May 11, 2026

shallowEquals has a minor bug in it that causes it to return too early if a prop has an equals method on it. This means that the order that props are defined causes them to change the rerender behavior (e.g. if prop 2 changes but prop 1 doesn't change, shallowEquals says they are the same and things are not rerendered).

The comment above the for loop says all keys, so it should loop through all keys before returning that objA and objB are equal. Change the method to return false if props are unequal, otherwise finish the loop before returning true.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 11, 2026

⚠️ No Changeset found

Latest commit: 0ade7d0

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

@ice1080
Copy link
Copy Markdown
Author

ice1080 commented May 11, 2026

Note that this is a minor fix until @abstrakt8 has time to work on #298 , as the changes in that also fix this bug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant