zalmoxisus / redux-devtools-extension

Redux DevTools extension.
MIT License
13.5k stars 1.01k forks source link

options.instanceId doesn't support Symbols as instance name. #826

Open senadir opened 2 years ago

senadir commented 2 years ago

Initiating __REDUX_DEVTOOLS_EXTENSION__.options.instanceId with a symbol would throw an error.

Uncaught DOMException: Failed to execute 'postMessage' on 'Window': Symbol(wc/store/cart) could not be cloned.
    at post (<anonymous>:13794:10)
    at toContentScript (<anonymous>:13885:3)
    at relay (<anonymous>:14240:5)
    at init (<anonymous>:14440:5)

Use case: I'm using redux devtools alongside @wordpress/data, which is a superset of redux that supports multiple stores along other things. @wordpress/data register each store with __REDUX_DEVTOOLS_EXTENSION__, using the store name as the name and instanceId for the plugin.

image

Reproduce steps: You can see this example https://codesandbox.io/s/silent-silence-fknrn?file=/src/index.js

Basically:

import { createStore } from "redux";
import { devToolsEnhancer } from "redux-devtools-extension";

const store = createStore(
  () => {},
  devToolsEnhancer({
    instanceId: Symbol("test")
  })
);

Possible fixes:

alexflorisca commented 2 years ago

Just pinging to see if there's any chance of getting this merged any time soon?