Skip to content

Fix the opening of our document panel in Gutenberg 17.4.1 - #21030

Merged
pls78 merged 2 commits into
release/21.9from
1288-major-gutenberg-cannot-read-properties-of-undefined-reading-includes
Jan 10, 2024
Merged

pls78 merged 2 commits into
release/21.9from
1288-major-gutenberg-cannot-read-properties-of-undefined-reading-includes

Conversation

@igorschoester

Copy link
Copy Markdown
Contributor

Context

Fix for #21024
Where I noted:

A problem with this detection is that when using Gutenberg plugin v17.4.1 the Yoast panel does not open. This is due to the selector not being in that version yet, it is scheduled to land in v17.5

Turns out this was only working in 17.4.1 because the old structure was still saved in the database and local storage.

Summary

This PR can be summarized in the following changelog entry:

  • Fixes a bug where our block editor integration would no longer work with Gutenberg 17.4.1.

Relevant technical choices:

  • Added all the safety now, after being bitten again 😅

Test instructions

Test instructions for the acceptance test before the PR gets merged

This PR can be acceptance tested by following these steps:

  • Have a fresh site
    • Or delete the wp_persisted_preferences from your user in the usermeta table
    • As well as delete the WP_PREFERENCES_USER_1 from your browser' local storage for your WP site (application tab)
  • Install and activate Gutenberg 17.4.1
  • Edit a post in the block editor
  • Verify you get our sidebar and the console error Cannot read properties of undefined (reading 'includes') is not there anymore

Relevant test scenarios

  • Changes should be tested with the browser console open
  • Changes should be tested on different posts/pages/taxonomies/custom post types/custom taxonomies
  • Changes should be tested on different editors (Block/Classic/Elementor/other)
  • Changes should be tested on different browsers
  • Changes should be tested on multisite

Test instructions for QA when the code is in the RC

  • QA should use the same steps as above.

QA can test this PR by following these steps:

Impact check

This PR affects the following parts of the plugin, which may require extra testing:

UI changes

  • This PR changes the UI in the plugin. I have added the 'UI change' label to this PR.

Other environments

  • This PR also affects Shopify. I have added a changelog entry starting with [shopify-seo], added test instructions for Shopify and attached the Shopify label to this PR.

Documentation

  • I have written documentation for this change.

Quality assurance

  • I have tested this code to the best of my abilities.
  • During testing, I had activated all plugins that Yoast SEO provides integrations for.
  • I have added unit tests to verify the code works as intended.
  • If any part of the code is behind a feature flag, my test instructions also cover cases where the feature flag is switched off.
  • I have written this PR in accordance with my team's definition of done.
  • I have checked that the base branch is correctly set.

Innovation

  • No innovation project is applicable for this PR.
  • This PR falls under an innovation project. I have attached the innovation label.
  • I have added my hours to the WBSO document.

Fixes https://github.com/Yoast/plugins-automated-testing/issues/1288

Fix for #21024
I thought it was safe for Gutenberg 17.4.1
However, it turns out that is only due to user metadata and/or local storage.
On a fresh install, the same error the PR above tried to solve will occur

This commit adds a fallback to prevent the error. So the functionality stays in tact.
Note that just a simple check would suffice to not error too, will add safety in the next commit.
As it turned out to be more fragile than I estimated, with the DB and local storage caching.
This is me being overly safe. This will mean we will not likely spot this logic going wrong if something changes again though.
@igorschoester igorschoester added the changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog label Jan 9, 2024
@igorschoester igorschoester added this to the 21.9 milestone Jan 9, 2024

@pls78 pls78 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

CR && Acc: ✅

@pls78
pls78 merged commit 9811898 into release/21.9 Jan 10, 2024
@pls78
pls78 deleted the 1288-major-gutenberg-cannot-read-properties-of-undefined-reading-includes branch January 10, 2024 08:53
@manuelaugustin manuelaugustin modified the milestones: 21.9, 21.8.1 Jan 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants