infinitered / infinitered/reactotron

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

Open Beginner friendly
#1,599 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
15.6k
Forks
972
PR merge metrics
No merged PRs in 30d

Description

In lib/reactotron-redux/src/commandHandler.ts line 53, when a state.keys.request resolves to a non-object value (e.g. a primitive), the keys response sends undefined instead of an empty array:

type === "state.keys.request"
  ? typeof filteredObj === "object"
    ? Object.keys(filteredObj)
    : undefined  // ← should be []
  : filteredObj

This causes StateKeysResponseCommand in the desktop app to crash on keys.map(). An error boundary was added in #1598 to prevent the crash, but the payload itself is still malformed per the StateKeysResponsePayload contract which defines keys: string[].

Fix: Change undefined to [].

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open lib/reactotron-redux/src/commandHandler.ts at line 53 and inspect the state.keys.request branch. Confirm how non-object state values are handled and compare the response with the StateKeysResponsePayload contract. Done means the branch returns an empty array for non-object values, preserving a string-array keys payload.

Written by the indexing model from the issue text.

Assessment

Tech stack
redux, typescript
Domain
devtools
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
88/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.