Skip to content

Commit

Permalink
fix: editor errors with reusable blocks (#89)
Browse files Browse the repository at this point in the history
* fix: editor error message in reusable blocks

* fix: editor display of multiple categories
  • Loading branch information
dkoo authored Jul 6, 2021
1 parent 748810d commit fdc46d3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/blocks/listing/listing.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const Listing = ( { attributes, error, post } ) => {
{ category.map( ( _category, index ) => (
<Fragment key="index">
{ decodeEntities( _category.name ) }
{ index + 1 < _category.length && ', ' }
{ index + 1 < category.length && ', ' }
</Fragment>
) ) }
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/editor/shadow-taxonomies/child-listings.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,11 +264,11 @@ const ChildListingsComponent = ( { hideChildren, postId, updateMetaValue } ) =>

const mapStateToProps = select => {
const { getCurrentPostId, getEditedPostAttribute } = select( 'core/editor' );
const meta = getEditedPostAttribute( 'meta' );
const meta = getEditedPostAttribute( 'meta' ) || {};

return {
getEditedPostAttribute,
hideChildren: meta.newspack_listings_hide_children,
hideChildren: meta?.newspack_listings_hide_children,
postId: getCurrentPostId(),
};
};
Expand Down
4 changes: 2 additions & 2 deletions src/editor/shadow-taxonomies/parent-listings.js
Original file line number Diff line number Diff line change
Expand Up @@ -333,11 +333,11 @@ const ParentListingsComponent = ( { hideParents, postId, updateMetaValue } ) =>

const mapStateToProps = select => {
const { getCurrentPostId, getEditedPostAttribute } = select( 'core/editor' );
const meta = getEditedPostAttribute( 'meta' );
const meta = getEditedPostAttribute( 'meta' ) || {};

return {
getEditedPostAttribute,
hideParents: meta.newspack_listings_hide_parents,
hideParents: meta?.newspack_listings_hide_parents,
postId: getCurrentPostId(),
};
};
Expand Down

0 comments on commit fdc46d3

Please sign in to comment.