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

Decouple snippet data and initialization cleanup #21328

Merged
merged 10 commits into from
May 31, 2024

Conversation

vraja-pro
Copy link
Contributor

@vraja-pro vraja-pro commented Apr 23, 2024

Context

  • Snippet editor has more complex way of using the hidden fields. We want to make the yoast editor store as the source of truth and sync values to the hidden fields.

Summary

This PR can be summarized in the following changelog entry:

  • Remove the old sync methods and variables.

Relevant technical choices:

  • setDataFromSnippet is used as a sync function to the hidden fields for the snippet editor data. I left only the case for slug since it is not meta and the sync is done within the editor.
  • We set focus keyword in the initial state regardless of the analysis feature active or not. It doesn't make a difference.
  • In the feature branch I added is_cornerstone to the initial state, so I'm removing the initializing and the syncing from the post data collector.

Test instructions

Test instructions for the acceptance test before the PR gets merged

This PR can be acceptance tested by following these steps:

  • Without premium or other Yoast add-ons:
  • Edit a post.
  • Go to Google preview
  • Change title, description and slug, try also with replacement variables
  • Save and refresh, check it is saved
  • Change focus keyphrase and is cornerstone and save.
  • Refresh and check it is saved.

Repeat the tests for

  • The term editor
  • The elementor editor
  • The classic editor

Test without metabox

  • Comment out line 81 in class-metabox.php:
// add_action( 'add_meta_boxes', [ $this, 'add_meta_box' ] );
  • Edit a post.
  • Go to Google preview
  • Change title, description and slug, try also with replacement variables
  • Save and refresh, check it is saved.

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 (Default Block/Gutenberg/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. For example, comments in the Relevant technical choices, comments in the code, documentation on Confluence / shared Google Drive / Yoast developer portal, or other.

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 #21225

@vraja-pro vraja-pro added the changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog label Apr 23, 2024
@vraja-pro vraja-pro changed the title Decouple snippet data Decouple snippet data and initialization cleanup Apr 30, 2024
@vraja-pro vraja-pro self-assigned this Apr 30, 2024
@vraja-pro vraja-pro linked an issue May 3, 2024 that may be closed by this pull request
3 tasks
@vraja-pro vraja-pro force-pushed the 21141-decouple-hidden-fields-for-metabox branch from aa0bd0c to 3564749 Compare May 3, 2024 13:47
@vraja-pro vraja-pro force-pushed the decouple-snippet-data branch 2 times, most recently from 8246827 to 2cc3f49 Compare May 3, 2024 14:06
@vraja-pro vraja-pro force-pushed the decouple-snippet-data branch 2 times, most recently from 2f264d5 to 5031138 Compare May 7, 2024 13:02
@vraja-pro vraja-pro force-pushed the 21141-decouple-hidden-fields-for-metabox branch from f0a950e to ee04d6c Compare May 8, 2024 14:05
@vraja-pro vraja-pro force-pushed the decouple-snippet-data branch 4 times, most recently from 8194806 to 709e167 Compare May 10, 2024 12:39
Copy link
Member

@igorschoester igorschoester left a comment

Choose a reason for hiding this comment

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

CR 🏗️

packages/js/src/initializers/term-scraper.js Outdated Show resolved Hide resolved
packages/js/src/initializers/term-scraper.js Outdated Show resolved Hide resolved
packages/js/src/initializers/term-scraper.js Outdated Show resolved Hide resolved
Base automatically changed from 21141-decouple-hidden-fields-for-metabox to feature/decouple-hidden-fields May 16, 2024 15:11
@coveralls
Copy link

coveralls commented May 23, 2024

Pull Request Test Coverage Report for Build 1d06e2bcd8b4e364a23577dd57f6d091a0c70a0b

Details

  • 0 of 18 (0.0%) changed or added relevant lines in 3 files are covered.
  • 3848 unchanged lines in 111 files lost coverage.
  • Overall coverage decreased (-4.4%) to 48.381%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/js/src/initializers/term-scraper.js 0 4 0.0%
packages/js/src/analysis/PostDataCollector.js 0 5 0.0%
packages/js/src/initializers/post-scraper.js 0 9 0.0%
Files with Coverage Reduction New Missed Lines %
admin/class-option-tabs-formatter.php 1 0.0%
packages/js/src/analysis/TermDataCollector.js 1 37.5%
packages/js/src/initializers/post-scraper.js 1 0.0%
src/actions/configuration/first-time-configuration-action.php 1 91.84%
src/builders/indexable-home-page-builder.php 1 98.0%
src/builders/indexable-term-builder.php 1 99.15%
src/context/meta-tags-context.php 1 28.29%
src/generators/breadcrumbs-generator.php 1 64.23%
src/generators/schema/webpage.php 1 90.32%
src/integrations/blocks/structured-data-blocks.php 1 16.0%
Totals Coverage Status
Change from base Build 1ed281fdbf6aa9284055b9f436a7f3afde9fc47c: -4.4%
Covered Lines: 24965
Relevant Lines: 53480

💛 - Coveralls

@vraja-pro vraja-pro assigned igorschoester and unassigned vraja-pro May 23, 2024
@igorschoester igorschoester removed their assignment May 23, 2024
@thijsoo thijsoo self-assigned this May 31, 2024
Copy link
Contributor

@thijsoo thijsoo left a comment

Choose a reason for hiding this comment

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

CR + ACC 👍

@thijsoo thijsoo merged commit 63f1c20 into feature/decouple-hidden-fields May 31, 2024
14 of 16 checks passed
@thijsoo thijsoo deleted the decouple-snippet-data branch May 31, 2024 10:11
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.

Decouple Google preview hidden fields
4 participants