Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
senadir opened this issue Dec 14, 2021 · 1 comment
Open

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

senadir opened this issue Dec 14, 2021 · 1 comment

Comments

@senadir
Copy link

senadir commented Dec 14, 2021

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:

  • Detect if instanceId is a symbol typeof instanceId === 'symbol' and serialize it instanceId.toString() which would give you 'Symbol("test")'.
@alexflorisca
Copy link

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

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

No branches or pull requests

2 participants