Skip to content

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

@joshuayoes

Description

@joshuayoes

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 [].

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions