Skip to content

app-core: keep the persist setting when an instance is removed - #2127

Open
RaphaelFakhri wants to merge 1 commit into
reduxjs:mainfrom
RaphaelFakhri:app-core-keep-persist-on-remove
Open

RaphaelFakhri wants to merge 1 commit into
reduxjs:mainfrom
RaphaelFakhri:app-core-keep-persist-on-remove

Conversation

@RaphaelFakhri

@RaphaelFakhri RaphaelFakhri commented Oct 17, 2026 •

Copy link
Copy Markdown

Summary

removeState in packages/redux-devtools-app-core/src/reducers/instances.ts returns a new instances state built from scratch, without persisted. Any REMOVE_INSTANCE therefore resets the persist setting to undefined.

Based on where REMOVE_INSTANCE is dispatched, this has two effects:

  • In the standalone app, a store disconnecting turns the persist button off on its own.
  • In the extension, turning persist off does not work on the first click when a closed tab's instance is still kept. togglePersist() in the background removes disconnected instances before the toggle reaches the reducer. The removal clears persisted, so TOGGLE_PERSIST flips undefined to true and the monitors receive SET_PERSIST with true.

Changes

  • Spread the previous state into the object that removeState returns, so fields it does not change are preserved.
  • Add a reducer test for REMOVE_INSTANCE that checks persisted is kept.
  • Add a patch changeset for @redux-devtools/app-core.

Testing

pnpm vitest --run --project app-core test/instances.spec.ts fails without the fix (expected undefined to be true) and passes with it.

Fixes #2126

removeState rebuilt the instances state without the persisted flag, so
removing an instance turned persist off. In the extension, turning
persist off removes disconnected instances first, which cleared the flag
before the toggle flipped it back on.
@changeset-bot

changeset-bot Bot commented Oct 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 8225e3c

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

This PR includes changesets to release 1 package
Name Type
@redux-devtools/app-core 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

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.

Persist setting is lost when an instance is removed

1 participant