Skip to content

fix(Page): disconnect MutationObserver after hash target is found#8007

Merged
alexander-akait merged 7 commits into
webpack:mainfrom
mr-baraiya:fix-mutation-observer
Mar 14, 2026
Merged

fix(Page): disconnect MutationObserver after hash target is found#8007
alexander-akait merged 7 commits into
webpack:mainfrom
mr-baraiya:fix-mutation-observer

Conversation

@mr-baraiya
Copy link
Copy Markdown
Contributor

The MutationObserver continued observing the DOM even after the hash target element was found.
This change disconnects the observer once the element is located, preventing unnecessary DOM observations.

@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
webpack-js-org Ready Ready Preview, Comment Mar 14, 2026 2:09pm

Request Review

Copy link
Copy Markdown
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

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

You need to write cypress test for such things to ensure we don't break something

@mr-baraiya
Copy link
Copy Markdown
Contributor Author

I've added Cypress tests to cover the behavior and fixed the ESLint issue ("use strict" requirement) so the checks pass.

@alexander-akait
Copy link
Copy Markdown
Member

Here tests are failed too

@mr-baraiya
Copy link
Copy Markdown
Contributor Author

I’ve added the Cypress test and updated it to make the hash navigation behavior more stable. All checks are now passing.


cy.get("h2, h3", { timeout: 10000 }).should("exist");
});
});
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.

Please write the useful test - you test nothing here

Copy link
Copy Markdown
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

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

Please write the real test

@mr-baraiya
Copy link
Copy Markdown
Contributor Author

I've updated the Cypress test to verify the actual hash navigation behavior.

@alexander-akait alexander-akait merged commit 7348ba3 into webpack:main Mar 14, 2026
9 checks passed
@mr-baraiya mr-baraiya deleted the fix-mutation-observer branch March 14, 2026 16:03
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