Visitar URL original
Fix issue with `shallowEquals` incorrectly returning too early by ice1080 · Pull Request #319 · playcanvas/react · GitHub
Skip to content

Fix issue with shallowEquals incorrectly returning too early - #319

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

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

Conversation

@ice1080

@ice1080 ice1080 commented May 11, 2026 •

Copy link
Copy Markdown
Contributor

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

changeset-bot Bot commented May 11, 2026

Copy link
Copy Markdown

⚠️ 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

ice1080 commented May 11, 2026 •

Copy link
Copy Markdown
Contributor Author

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

@ice1080

ice1080 commented Sep 10, 2026

Copy link
Copy Markdown
Contributor Author

Replaced by #344, which moves this contribution to ice1080:fix/shallow-equals and includes the merge of current upstream main with the conflict resolved. Continuing review there.

@ice1080 ice1080 closed this Sep 10, 2026
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