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

Fix error when editing Pattern Blocks #147

Merged
merged 1 commit into from
Jun 26, 2024

Conversation

maugelves
Copy link
Contributor

@maugelves maugelves commented Jun 26, 2024

When a user tries to edit a Block Pattern in the content itself, the plugin throws this error:

TypeError: Cannot read properties of undefined (reading 'length')
    at AuthorsSelect (AuthorsSelect.tsx:61:1)
    at wt (react-dom.min.js?ver=18.2.0:10:47637)
    at js (react-dom.min.js?ver=18.2.0:10:120584)
    at wl (react-dom.min.js?ver=18.2.0:10:88659)
    at bl (react-dom.min.js?ver=18.2.0:10:88587)
    at yl (react-dom.min.js?ver=18.2.0:10:88450)
    at il (react-dom.min.js?ver=18.2.0:10:85274)
    at fl (react-dom.min.js?ver=18.2.0:10:85661)
    at Nn (react-dom.min.js?ver=18.2.0:10:32474)
    at react-dom.min.js?ver=18.2.0:10:83226

Adding an extra check in a conditional fixed the problem.

@maugelves maugelves self-assigned this Jun 26, 2024
Copy link
Contributor

@roborourke roborourke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @maugelves, I guess this is an issue when the editor now switches contexts between post types that support authorship and those that don't, or don't have set yet.

Makes me think this change in core will impact a lot of existing features / functionality :/

@maugelves maugelves merged commit db82436 into develop Jun 26, 2024
4 checks passed
@maugelves maugelves deleted the fix/error-editing-block-patterns branch June 26, 2024 13:26
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

Successfully merging this pull request may close these issues.

2 participants