Skip to content

fix(reactotron-redux): return empty keys for primitive state paths - #1616

Open
giaBaoJS wants to merge 1 commit into
infinitered:masterfrom
giaBaoJS:fix/redux-state-keys-primitive-response
Open

fix(reactotron-redux): return empty keys for primitive state paths#1616
giaBaoJS wants to merge 1 commit into
infinitered:masterfrom
giaBaoJS:fix/redux-state-keys-primitive-response

Conversation

@giaBaoJS

Copy link
Copy Markdown

Please verify the following:

  • yarn build-and-test:local passes
  • I have added tests for any new features, if relevant
  • README/docs are not affected by this internal payload correction

Describe your PR

state.keys.request currently forwards undefined when a requested Redux path resolves to a primitive or is invalid. That violates StateKeysResponsePayload.keys: string[] and can break desktop consumers that iterate the field.

This returns an empty key list for non-object paths. The null guard is intentional: typeof null === "object", so checking only typeof would call Object.keys(null) and throw. Object paths still use Object.keys, while state.values.request keeps forwarding the original value unchanged.

Fixes #1599.

Verification

  • yarn build-and-test:local
  • yarn workspace reactotron-redux test --runInBand — 8 suites, 53 passed, 3 todo
  • Packed reactotron-redux and inspected the compiled CommonJS handler
  • Ran the real Redux handler into the desktop StateKeysResponseCommand; a primitive path produced keys: [] and rendered the empty-state message without entering the error boundary
  • Counterfactual: reverting only the source fix with the final tests kept fails three cases (undefined for primitive and invalid paths, plus Object.keys(null)); restoring the fix passes

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.

Redux plugin sends undefined instead of [] for state keys on non-object paths

1 participant