humanmade / hm-gutenberg-tools

Useful helpers, components or tools for building things with Gutenberg

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Uncaught ReferenceError: hm is not defined (Gutenberg 3.7)

nicolairobles opened this issue · comments

In using PostControls, the below no longer works with Gutenberg 3.7

const { PostControl } = hm.controls;

This would be great to have working in 3.7! I hope this gets some traction.

Confirmed.

From the console:
TypeError: i is not a function editor.bundle.js:11:36538

As a consequence:
ReferenceError: hm is not defined in blocks.build.js

Ah yes this is a known issue.

I have actually been working on an update - I have refactored the post select UI to use the core data store instead. However this may also require some changes to your implementation. You can check out the branch here - #34

@mattheu there does seem to be some odd behavior happening with the refactored branch.

Whereas before we had a PostControl like below that pulled in posts of the postType: "smart-list", the code in this branch just pulls in "posts".

<PostControl
   label={ __( 'Select a List' ) }
   value={ [ listId ] }
   onChange={ posts => setAttributes( { listId: posts[0].id } ) }
   btnText={ __( 'Select Smart List' ) }
   postSelectProps={ { postType: 'smart-list' } }
/>