Skip to content

Fix case when multiple introductions are prevented to be seen in the FTC#22574

Merged
vraja-pro merged 5 commits intotrunkfrom
22565-race-condition-when-visiting-the-ftc-page-and-more-than-one-introduction-is-set-to-be-seen-alt
Sep 17, 2025
Merged

Fix case when multiple introductions are prevented to be seen in the FTC#22574
vraja-pro merged 5 commits intotrunkfrom
22565-race-condition-when-visiting-the-ftc-page-and-more-than-one-introduction-is-set-to-be-seen-alt

Conversation

@leonidasmi
Copy link
Copy Markdown
Contributor

@leonidasmi leonidasmi commented Sep 16, 2025

Context

  • Prevent race conditions in API requests in the FTC, by making sure each request (and the later action) is fired only after the previous request finishes, by properly using async/await.

Summary

This PR can be summarized in the following changelog entry:

  • Fixes a bug where the introduction with the highest priority will never be seen, if the user reaches the FTC without reaching any other Yoast page and there are multiple introductions to be displayed.

Relevant technical choices:

Test instructions

Test instructions for the acceptance test before the PR gets merged

This PR can be acceptance tested by following these steps:

  • In a fresh site (or with the _yoast_wpseo_introductions usermeta deleted), install the RC but dont go to any Yoast page
  • To easily see multiple introductions, enable the Black Friday one
    • You can do that by edit src\promotions\domain\black-friday-promotion.php: new Time_Interval( \gmmktime( 10, 00, 00, 11, 28, 2024 ), \gmmktime( 10, 00, 00, 12, 3, 2026 ) )
  • Before visiting any Yoast page, go straight to the FTC
  • Visit any other Yoast page now

Without this fix:

  • You will get the BF modal and after you refresh you will never see the AI insight one

With this fix:

  • You will first see the BF. If you refresh, now you will see the AI insight one.

Test for Premium introductions:

  • Activate Free and Premium in a fresh site (or with the introduction usermeta deleted)
  • Because we currently do have an introduction modal that's set to be seen in a Yoast page, let's edit the ai-optimize-classic that's set to be displayed in the classic post editor
    • In src\introductions\application\ai-optimize-classic-introduction.php make should_show() return true early.
  • Go to the FTC without going through any other Yoast page
  • Revert your change in ai-optimize-classic-introduction.php
  • Go to a Yoast page

Without this fix:

  • You wouldnt get the AI Insights upsell

With this fix:

  • You would get the AI Insights upsell
  • If you now go to a classic post editor, you will also get the AI optimize classic introduction, as per the instructions here.

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.

Impact check

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

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 #

@leonidasmi leonidasmi added the changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog label Sep 16, 2025
@coveralls
Copy link
Copy Markdown

coveralls commented Sep 16, 2025

Pull Request Test Coverage Report for Build 1289519f40fada290a125c7bb471af2f47d07a0b

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 0 of 8 (0.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.002%) to 53.205%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/js/src/introductions/initialize.js 0 8 0.0%
Totals Coverage Status
Change from base Build 291e2f3fbb6dcfc7315fbdcaaaa8b6ecd0c36e4e: -0.002%
Covered Lines: 31733
Relevant Lines: 59861

💛 - Coveralls

Copy link
Copy Markdown
Contributor

@vraja-pro vraja-pro left a comment

Choose a reason for hiding this comment

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

CR & AC ✅

@vraja-pro vraja-pro added this to the 26.1 milestone Sep 17, 2025
@vraja-pro vraja-pro merged commit 05b3a03 into trunk Sep 17, 2025
19 checks passed
@vraja-pro vraja-pro deleted the 22565-race-condition-when-visiting-the-ftc-page-and-more-than-one-introduction-is-set-to-be-seen-alt branch September 17, 2025 11:25
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.

Race condition when visiting the FTC page and more than one introduction is set to be seen

3 participants