redux-devtools icon indicating copy to clipboard operation
redux-devtools copied to clipboard

Disconnecting specific store instances

Open PrettyCoffee opened this issue 2 years ago • 1 comments

Hello! When having multiples store instances in one tab, how would you disconnect a single one?

The only disconnect function I found in the documentation is window.__REDUX_DEVTOOLS_EXTENSION__.disconnect() which disconnects all store instances at once.

Example:

const connectionA = window.__REDUX_DEVTOOLS_EXTENSION__.connect({name: "store a"})
connectionA.init("value1") 

const connectionB = window.__REDUX_DEVTOOLS_EXTENSION__.connect({name: "store b"})
connectionB.init("value2")

When calling window.__REDUX_DEVTOOLS_EXTENSION__.disconnect() this would disconnect all stores.

Is there something like connectionA.disconnect() or window.__REDUX_DEVTOOLS_EXTENSION__.disconnect(connectionA) to only disconnect one and removing it from the instances dropdown? image

I also found connectionA.unsubscribe(), but it only removes the listeners applied with connectionA.subscribe(), but not remove it from the instances dropdown in the extension.

If it's not a feature yet, is it planned to introduce something like that?

PrettyCoffee avatar Mar 13 '23 18:03 PrettyCoffee

As I see the problem is related to https://github.com/reduxjs/redux-devtools/issues/366. But no answer so far. I also have interest in this topic.

piskunovim avatar Mar 15 '23 10:03 piskunovim