Skip to content

[docs-infra] Fix AbortController error #46408

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

oliviertassinari
Copy link
Member

@oliviertassinari oliviertassinari commented Jun 23, 2025

This is a regression from #45596: checkout the PR, and go to ANY pages in dev mode, e.g. https://0.0.0.0:3000/, you will get (at least, I do):

SCR-20250623-pqbt

The root of the problem seems to be with SimilarWeb https://chromewebstore.google.com/detail/similarweb-website-traffi/hoklmmgfnpapgjgcpechhaamimifchmp?hl=en&pli=1, when I disable the extension, it works as expected. Now, AbortControlled seems not needed in this context; a variable is as simple and provides the same behavior.

I noticed this while I was iterating on #46228.

@oliviertassinari oliviertassinari added website Pages that are not documentation-related, marketing-focused. regression 🐛 A bug, but worse labels Jun 23, 2025
@mui-bot
Copy link

mui-bot commented Jun 23, 2025

Netlify deploy preview

https://deploy-preview-46408--material-ui.netlify.app/

Bundle size report

Bundle Parsed Size Gzip Size
@mui/material 0B(0.00%) 0B(0.00%)
@mui/lab 0B(0.00%) 0B(0.00%)
@mui/system 0B(0.00%) 0B(0.00%)
@mui/utils 0B(0.00%) 0B(0.00%)

Details of bundle changes

Generated by 🚫 dangerJS against d730030

@oliviertassinari oliviertassinari added the docs Improvements or additions to the documentation label Jun 23, 2025
@oliviertassinari oliviertassinari force-pushed the fix-regression-homepage-v2 branch from 47e2c92 to d730030 Compare June 23, 2025 16:22
@oliviertassinari oliviertassinari changed the title [website] Fix error regression homepage [docs] Fix error regression homepage Jun 23, 2025
@oliviertassinari oliviertassinari changed the title [docs] Fix error regression homepage [docs-infra] Fix AbortController error Jun 23, 2025
@oliviertassinari oliviertassinari added the scope: docs-infra Specific to the docs-infra product label Jun 23, 2025
@oliviertassinari oliviertassinari requested a review from dav-is June 23, 2025 16:30
Copy link
Member

@dav-is dav-is left a comment

Choose a reason for hiding this comment

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

I think AbortController is the right thing to use with useEffect.

I was able to repro and fix by just adding a reason for aborting:

abortController.abort('useEffect cleanup');

@oliviertassinari
Copy link
Member Author

oliviertassinari commented Jun 28, 2025

I was able to repro and fix by just adding a reason for aborting:

@dav-is The problem is still here when I apply the diff proposed:

SCR-20250628-pylh

I don't get the Next.js error overlay, but spam in the console is equally not acceptable.

@dav-is
Copy link
Member

dav-is commented Jun 28, 2025

@oliviertassinari To fix the Error loading CSS with layer: useEffect cleanup log, this line also needs to be updated to this:

        if (error !== 'useEffect cleanup' && error.name !== 'AbortError') {

I’m seeing an uncaught promise error that actually originates in the extension itself. It overrides window.fetch, apparently to inject polyfills, but the custom implementation doesn’t support AbortController. On any page using AbortController, it will throw. This seems like a bug in the extension, so it’d be great to file an issue with the author. Monkey-patching the global fetch in an extension is risky. If they need polyfills, it should be scoped or exposed via a dedicated helper rather than replacing window.fetch outright.

Screenshot From 2025-06-28 13-17-24

In our code, we rely on AbortController to cancel an in-flight request when a new one starts or when unmounting. If this PR was merged as is, the original HTTP request never stops, leading to wasted bandwidth and potential memory leaks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to the documentation regression 🐛 A bug, but worse scope: docs-infra Specific to the docs-infra product website Pages that are not documentation-related, marketing-focused.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants