Skip to content

fix(react-paypal-js): compare own keys when memoizing eligibility payloads - #1043

Open
OskarEichler wants to merge 3 commits into
paypal:mainfrom
OskarEichler:codex/eligibility-own-key-equality
Open

OskarEichler wants to merge 3 commits into
paypal:mainfrom
OskarEichler:codex/eligibility-own-key-equality

Conversation

@OskarEichler

Copy link
Copy Markdown

Fix

Require each compared object key to be an own property of the other object before recursively comparing its value. Equal key counts and equal property lookups alone do not establish equality: {a: undefined} and {b: undefined} previously compared equal, as could an inherited property standing in for a missing own key.

This prevents deep-comparison memoization from reusing a different eligibility payload. Existing reference, array, depth-limit and value comparison behavior is preserved; no new dependency or public API.

Verification

Inline reproductions confirm both distinct-undefined-key and inherited-key false positives change from true to false. Combined reviewed patch set: existing React suite has 914 passes, 2 pre-existing HostedFieldsProvider failures and 17 passing snapshots, identical to unmodified main. Lint/typecheck, Rollup builds, declarations and diff/format checks pass (five existing JSDoc warnings). No test files changed.

@OskarEichler
OskarEichler requested a review from a team as a code owner August 27, 2026 16:04
@changeset-bot

changeset-bot Bot commented Aug 27, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 70f7e5a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@paypal/react-paypal-js Patch

Not sure what this means? Click here to learn what changesets are.

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

@EvanReinstein

Copy link
Copy Markdown
Contributor

Can you add tests that demonstrate the issue this is fixing 👍

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.

2 participants