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

Redux Error on Component #231

Closed
andreibrindas opened this issue Jul 11, 2023 · 4 comments
Closed

Redux Error on Component #231

andreibrindas opened this issue Jul 11, 2023 · 4 comments

Comments

@andreibrindas
Copy link

When I want to use the component in React:

<IsolatedBlockEditor
                  settings={settings}
                    onSaveContent={(html) => saveContent(html)}
                    onLoad={(parse) => loadInitialContent(parse)}
                    onError={() => document.location.reload()}
                >
</IsolatedBlockEditor>

This is the error I get:

Cannot read properties of undefined (reading 'get')
TypeError: Cannot read properties of undefined (reading 'get')
    at eval (webpack:///./node_modules/@automattic/isolated-block-editor/build-module/components/with-registry-provider/interface-store/selectors.js?:27:103)
    at selector (webpack:///./node_modules/@wordpress/data/build-module/factory.js?:51:54)
    at eval (webpack:///./node_modules/@wordpress/data/build-module/redux-store/index.js?:216:20)
    at Object.runSelector [as getActiveComplementaryArea] (webpack:///./node_modules/@wordpress/data/build-module/redux-store/index.js?:366:14)
    at eval (webpack:///./node_modules/@automattic/isolated-block-editor/build-module/components/block-editor/index.js?:134:90)
    at eval (webpack:///./node_modules/@wordpress/data/build-module/components/use-select/index.js?:143:70)
    at __unstableMarkListeningStores (webpack:///./node_modules/@wordpress/data/build-module/registry.js?:140:23)
    at Object.eval [as __unstableMarkListeningStores] (webpack:///./node_modules/@wordpress/data/build-module/registry.js?:231:30)
    at updateValue (webpack:///./node_modules/@wordpress/data/build-module/components/use-select/index.js?:143:34)
    at eval (webpack:///./node_modules/@wordpress/data/build-module/components/use-select/index.js?:175:5)

I've tried to find some documentation about how to use this in React, but couldn't find any. Could somebody please point me in the right direction to using this project?

Thanks!

@LittleGit1
Copy link

LittleGit1 commented Jul 11, 2023

This issue has already been documented here. By importing the preferences reducer, selectors and actions from @wordpress/preferences module and using them in the iso.customStores array you can bypass this issue.

Although I believe this workaround is causing my allowBlocks array to be ignored.

@andreibrindas
Copy link
Author

andreibrindas commented Jul 11, 2023

Thanks a lot! That solved the issue, but I'm running into another two now...

ERROR
Cannot read properties of undefined (reading 'length')
TypeError: Cannot read properties of undefined (reading 'length')
    at getBlockInnerHTML (webpack:///./node_modules/@wordpress/blocks/build-module/api/serializer.js?:271:42)
    at serializeBlock (webpack:///./node_modules/@wordpress/blocks/build-module/api/serializer.js?:320:23)
    at eval (webpack:///./node_modules/@wordpress/blocks/build-module/api/serializer.js?:363:35)
    at Array.map (<anonymous>)
    at serialize (webpack:///./node_modules/@wordpress/blocks/build-module/api/serializer.js?:363:22)
    at saveBlocks (webpack:///./node_modules/@automattic/isolated-block-editor/build-module/components/content-saver/index.js?:49:141)
    at eval (webpack:///./node_modules/@automattic/isolated-block-editor/build-module/components/content-saver/index.js?:64:9)
    at commitHookEffectListMount (webpack:///./node_modules/react-dom/cjs/react-dom.development.js?:23145:26)
    at commitPassiveMountOnFiber (webpack:///./node_modules/react-dom/cjs/react-dom.development.js?:24921:13)
    at commitPassiveMountEffects_complete (webpack:///./node_modules/react-dom/cjs/react-dom.development.js?:24886:9)

ERROR
innerBlocks is not iterable (cannot read property undefined)
TypeError: innerBlocks is not iterable (cannot read property undefined)
    at flattenBlocks (webpack:///./node_modules/@wordpress/block-editor/build-module/store/reducer.js?:138:11)
    at getFlattenedBlocksWithoutAttributes (webpack:///./node_modules/@wordpress/block-editor/build-module/store/reducer.js?:172:10)
    at eval (webpack:///./node_modules/@wordpress/block-editor/build-module/store/reducer.js?:572:27)
    at eval (webpack:///./node_modules/@wordpress/block-editor/build-module/store/reducer.js?:448:21)
    at eval (webpack:///./node_modules/@wordpress/block-editor/build-module/store/reducer.js?:498:23)
    at Object.eval [as blocks] (webpack:///./node_modules/@wordpress/block-editor/build-module/store/reducer.js?:734:10)
    at eval (eval at <anonymous> (webpack:///./node_modules/turbo-combine-reducers/index.js?), <anonymous>:3:29)
    at combinedReducer (webpack:///./node_modules/turbo-combine-reducers/index.js?:36:15)
    at Object.eval [as root] (webpack:///./node_modules/@wordpress/block-editor/build-module/store/reducer.js?:1918:23)
    at eval (eval at <anonymous> (webpack:///./node_modules/turbo-combine-reducers/index.js?), <anonymous>:3:67)

I think it's worth it to mention that I'm using it as a module installed from NPM.

@andreibrindas
Copy link
Author

Actually, the problem was because the onLoad() function isn't right as I've written it. Will look more into it.
Thanks again!

@johngodley
Copy link
Member

I'm going to close this for now but reopen if there is still an issue.

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

3 participants