Skip to content

Fix infinite indexing loop bug#23050

Open
pls78 wants to merge 4 commits into
trunkfrom
ai-hackaton/fix-infinite-indexing-bug
Open

Fix infinite indexing loop bug#23050
pls78 wants to merge 4 commits into
trunkfrom
ai-hackaton/fix-infinite-indexing-bug

Conversation

@pls78
Copy link
Copy Markdown
Member

@pls78 pls78 commented Mar 5, 2026

Context

Fixes an infinite indexing loop that could occur when the SEO data optimization process gets stuck re-processing the same batch of indexables indefinitely. This also exposes a helper needed by premium's prominent words indexation on non-editor pages.

Summary

This PR can be summarized in the following changelog entries:

  • Fixes a bug where the SEO data optimization could loop infinitely when the server returned the same batch of indexables repeatedly.
  • Exposes the doAjaxRequest helper via window.yoast.indexing.helpers so premium add-ons can use it on indexing pages outside the editor.

Relevant technical choices:

  • The infinite loop guard compares both the next_url and the first object_id in the response to detect when the server is stuck returning the same batch. If both match the previous iteration, an error is thrown to break the loop.
  • doAjaxRequest is exposed on window.yoast.indexing.helpers rather than window.yoast.editorModules because the indexation page does not load editor modules.

Test instructions

Test instructions for the acceptance test before the PR gets merged

This PR can be acceptance tested by following these steps:

  1. Install and activate Yoast SEO (and optionally Yoast SEO Premium).
  2. Go to Yoast SEO → Tools → SEO Data Optimization.
  3. Click Start SEO data optimization and verify it completes successfully without looping.
  4. Open the browser console and verify no "Indexing loop detected" errors appear during normal operation.
  5. (With Premium) Verify that prominent words indexation also completes without errors.

Relevant test scenarios

  • Changes should be tested with the browser console open

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:

  • SEO data optimization / indexation process
  • First-time configuration indexation step
  • window.yoast.indexing JavaScript API surface

Other environments

  • This PR also affects Shopify.
  • This PR also affects Yoast SEO for Google Docs.

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.
  • I have run grunt build:images and commited the results, if my PR introduces new images or SVGs.

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.

pls78 added 2 commits March 5, 2026 14:55
Make the ajaxHelper available on all pages where indexing runs
(Tools, Dashboard, FTC), not just editor pages where
window.yoast.editorModules is defined. This allows Premium's
prominent words indexation to access it reliably.
Detect when the server returns the same batch twice (same next_url
and same first object_id) and surface an error instead of looping
forever. Applies to both the Tools page and FTC indexation components.
@pls78 pls78 added the changelog: bugfix Needs to be included in the 'Bugfixes' category in the changelog label Mar 5, 2026
@coveralls
Copy link
Copy Markdown

coveralls commented Mar 5, 2026

Pull Request Test Coverage Report for Build 58c73f3343ba0bee70e2914c206095ffb8a51e8f

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

  • 5 of 13 (38.46%) changed or added relevant lines in 3 files are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.02%) to 53.898%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/js/src/components/Indexation.js 5 6 83.33%
packages/js/src/indexation.js 0 1 0.0%
packages/js/src/first-time-configuration/tailwind-components/steps/indexation/indexation.js 0 6 0.0%
Files with Coverage Reduction New Missed Lines %
packages/js/src/general/components/opt-in-container.js 2 5.88%
Totals Coverage Status
Change from base Build 655ef32d56e1796ff53d6012616cc430da9ffa1d: -0.02%
Covered Lines: 34243
Relevant Lines: 63660

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog: bugfix Needs to be included in the 'Bugfixes' category in the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants