Skip to content

Conversation

@mydea
Copy link
Member

@mydea mydea commented Apr 16, 2025

We have a lot of issues like this: https://sentry.sentry.io/issues/5543047544/?project=1267915

SyntaxError: Failed to construct 'IntersectionObserver': rootMargin must be specified in pixels or percent.

TBH not sure how that happens, but I guess we can try to be defensive here. Maybe inner height is missing somehow?

@mydea mydea requested review from a-hariti and chargome April 16, 2025 12:41
@mydea mydea self-assigned this Apr 16, 2025
@vercel
Copy link

vercel bot commented Apr 16, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
develop-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 23, 2025 6:47am
sentry-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 23, 2025 6:47am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
changelog ⬜️ Ignored (Inspect) Visit Preview Apr 23, 2025 6:47am

const headings = tocItems.map(item => item.element);
headings.forEach(heading => observer.observe(heading));
return () => headings.forEach(heading => observer.unobserve(heading));
return () => observer.disconnect();
Copy link
Member Author

Choose a reason for hiding this comment

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

I think this is better, we can tear down the whole observer like this I believe? I can't even find unobserve here: https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver/disconnect 🤔

@codecov
Copy link

codecov bot commented Apr 16, 2025

Bundle Report

Changes will decrease total bundle size by 19 bytes (-0.0%) ⬇️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
sentry-docs-server-cjs 11.14MB -9 bytes (-0.0%) ⬇️
sentry-docs-client-array-push 9.47MB -10 bytes (-0.0%) ⬇️

Affected Assets, Files, and Routes:

view changes for bundle: sentry-docs-server-cjs

Assets Changed:

Asset Name Size Change Total Size Change (%)
1729.js -3 bytes 1.75MB -0.0%
../instrumentation.js -3 bytes 1.08MB -0.0%
9523.js -3 bytes 1.05MB -0.0%
view changes for bundle: sentry-docs-client-array-push

Assets Changed:

Asset Name Size Change Total Size Change (%)
static/chunks/pages/_app-*.js -3 bytes 868.7kB -0.0%
static/chunks/8165-*.js -3 bytes 410.1kB -0.0%
static/chunks/404-*.js -4 bytes 43.44kB -0.01%
server/middleware-*.js -5.55kB 1.0kB -84.74%
server/middleware-*.js 5.55kB 6.55kB 555.3% ⚠️
static/Gm441tTmkE4lflR3UZFya/_buildManifest.js (New) 578 bytes 578 bytes 100.0% 🚀
static/Gm441tTmkE4lflR3UZFya/_ssgManifest.js (New) 77 bytes 77 bytes 100.0% 🚀
static/QvrOwIj67vseYOd0FTOYr/_buildManifest.js (Deleted) -578 bytes 0 bytes -100.0% 🗑️
static/QvrOwIj67vseYOd0FTOYr/_ssgManifest.js (Deleted) -77 bytes 0 bytes -100.0% 🗑️

Files in static/chunks/404-*.js:

  • ./src/components/sidebarTableOfContents/index.tsx → Total Size: 6.9kB

Copy link
Member

@chargome chargome left a comment

Choose a reason for hiding this comment

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

Let's try!

const rootMarginBottomRaw = (2 / 3) * window.innerHeight - rootMarginTop;
const rootMarginBottom = Math.floor(rootMarginBottomRaw);
const rootMarginBottomRaw = (2 / 3) * innerHeight - rootMarginTop;
const rootMarginBottom = Math.floor(rootMarginBottomRaw) * -1;
Copy link
Member

Choose a reason for hiding this comment

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

Strange that we still run into this, I thought the floor call here fixed this 🤔

mydea added 2 commits April 22, 2025 15:26
We have a lot of issues like this: https://sentry.sentry.io/issues/5543047544/?project=1267915

TBH not sure how that happens, but I guess we can try to be defensive here. Maybe inner height is missing somehow?
@mydea mydea force-pushed the fn/fix-intersection-observer branch from 2a93bf0 to 4fa0baa Compare April 22, 2025 13:26
@mydea mydea merged commit 3ddd8d0 into master Apr 23, 2025
17 checks passed
@mydea mydea deleted the fn/fix-intersection-observer branch April 23, 2025 07:32
bitsandfoxes pushed a commit that referenced this pull request Apr 24, 2025
We have a lot of issues like this: https://sentry.sentry.io/issues/5543047544/?project=1267915

TBH not sure how that happens, but I guess we can try to be defensive here. Maybe inner height is missing somehow?
@github-actions github-actions bot locked and limited conversation to collaborators May 9, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants