Skip to content

Conversation

sfanahata
Copy link
Contributor

@sfanahata sfanahata commented Sep 12, 2025

DESCRIBE YOUR PR

Summary
Enhanced the platform redirect system to show individual JavaScript frameworks (React, Vue, Angular, etc.) as separate, nested options under the main JavaScript platform. This provides users with a more customized and framework-specific experience when selecting their platform. Also added better logic to check for guide paths because Dart also wasn't showing up due to being nested.

Problem
When users clicked platform-redirect links (like /platform-redirect/?next=/session-replay/privacy/), they only saw top-level platforms (JavaScript, Android, React Native). This didn't reflect that many JavaScript frameworks have different support levels for specific features, and users couldn't easily select their specific framework for a more tailored experience. They also did not see Dart, which was nested under a Dart/Flutter guide.

Solution

  • Automatic Framework Detection: The system now reads the notSupported frontmatter from JavaScript documentation pages to determine which frameworks support each feature. Added more robust logic to search for guides under each platform if main platform paths are empty.

  • Visual Nesting: JavaScript frameworks are indented under the main JavaScript platform for clear hierarchy
    Smart Positioning: JavaScript and its frameworks appear at the end of the platform list
    Framework-Specific URLs: Each framework links to the main JavaScript documentation for that feature

Example pages:
https://sentry-docs-git-platform-redirect-privacy-fix.sentry.dev/platform-redirect/?next=/session-replay/configuration/#network-details

https://sentry-docs-git-platform-redirect-privacy-fix.sentry.dev/platform-redirect/?next=/session-replay/privacy/

IS YOUR CHANGE URGENT?

Help us prioritize incoming PRs by letting us know when the change needs to go live.

  • Urgent deadline (GA date, etc.):
  • Other deadline:
  • None: Not urgent, can wait up to 1 week+

SLA

  • Teamwork makes the dream work, so please add a reviewer to your PRs.
  • Please give the docs team up to 1 week to review your PR unless you've added an urgent due date to it.
    Thanks in advance for your help!

PRE-MERGE CHECKLIST

Make sure you've checked the following before merging your changes:

  • Checked Vercel preview for correctness, including links
  • PR was reviewed and approved by any necessary SMEs (subject matter experts)
  • PR was reviewed and approved by a member of the Sentry docs team

Copy link

vercel bot commented Sep 12, 2025

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

Project Deployment Preview Comments Updated (UTC)
develop-docs Ready Ready Preview Comment Sep 12, 2025 6:24pm
sentry-docs Ready Ready Preview Comment Sep 12, 2025 6:24pm

cursor[bot]

This comment was marked as outdated.

Copy link

codecov bot commented Sep 12, 2025

Bundle Report

Changes will increase total bundle size by 3.01kB (0.01%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
sentry-docs-client-array-push 9.91MB -290 bytes (-0.0%) ⬇️
sentry-docs-server-cjs 12.63MB 3.3kB (0.03%) ⬆️

Affected Assets, Files, and Routes:

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 882.71kB -0.0%
static/chunks/8321-*.js -3 bytes 425.87kB -0.0%
static/media/7c239973d8aef789-*.woff2 (New) 32.56kB 32.56kB 100.0% 🚀
static/media/32c80fb7588b7a2e-*.woff2 (New) 32.48kB 32.48kB 100.0% 🚀
static/media/a5d9f2ead0568494-*.woff2 (New) 21.08kB 21.08kB 100.0% 🚀
static/media/5b25d60b4670300e-*.woff2 (New) 19.29kB 19.29kB 100.0% 🚀
static/media/fc5b975a09123a00-*.woff2 (New) 9.75kB 9.75kB 100.0% 🚀
static/media/99e31c27a1524300-*.woff2 (New) 9.35kB 9.35kB 100.0% 🚀
server/middleware-*.js 5.55kB 6.55kB 555.3% ⚠️
server/middleware-*.js -5.55kB 1.0kB -84.74%
static/ExNcUsgCOmlBP9gotfOep/_buildManifest.js (New) 684 bytes 684 bytes 100.0% 🚀
static/ExNcUsgCOmlBP9gotfOep/_ssgManifest.js (New) 77 bytes 77 bytes 100.0% 🚀
static/media/4fca85807f6c09f6-*.woff2 (Deleted) -32.6kB 0 bytes -100.0% 🗑️
static/media/d695df15e3ff125c-*.woff2 (Deleted) -32.58kB 0 bytes -100.0% 🗑️
static/media/acdf4f392b58827a-*.woff2 (Deleted) -21.13kB 0 bytes -100.0% 🗑️
static/media/501d9eeee6e2b0cc-*.woff2 (Deleted) -19.41kB 0 bytes -100.0% 🗑️
static/media/a72efd2c2476ebb2-*.woff2 (Deleted) -9.7kB 0 bytes -100.0% 🗑️
static/media/9d7436bc73437f75-*.woff2 (Deleted) -9.36kB 0 bytes -100.0% 🗑️
static/xRupahY1kY2OzRDOQcKsB/_buildManifest.js (Deleted) -684 bytes 0 bytes -100.0% 🗑️
static/xRupahY1kY2OzRDOQcKsB/_ssgManifest.js (Deleted) -77 bytes 0 bytes -100.0% 🗑️
view changes for bundle: sentry-docs-server-cjs

Assets Changed:

Asset Name Size Change Total Size Change (%)
1729.js -3 bytes 1.78MB -0.0%
../instrumentation.js -3 bytes 1.1MB -0.0%
9523.js -3 bytes 1.08MB -0.0%
../app/[[...path]]/page.js.nft.json 780 bytes 809.82kB 0.1%
../app/platform-redirect/page.js.nft.json 780 bytes 809.74kB 0.1%
../app/sitemap.xml/route.js.nft.json 780 bytes 807.21kB 0.1%
../app/platform-redirect/page.js 965 bytes 33.03kB 3.01%

Files in ../app/platform-redirect/page.js:

  • ./app/platform-redirect/page.tsx → Total Size: 10.46kB

App Routes Affected:

App Route Size Change Total Size Change (%)
/platform-redirect 965 bytes 2.59MB 0.04%

const platformCopy = {...platform_, url: guide.url};
// Update the platform reference to use the copy
Object.assign(platform_, platformCopy);
break;
Copy link

Choose a reason for hiding this comment

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

Bug: Platform URL Mutation Causes Framework Inheritance Issues

The code mutates the original platform_ object's url property within the filter callback, despite the stated intent to avoid mutation. This modifies shared state from extractPlatforms(rootNode) and can lead to unexpected side effects. As a result, JavaScript frameworks derived from a mutated javascriptPlatform may inherit an incorrect, guide-specific URL instead of the main platform URL.

Additional Locations (1)

Fix in Cursor Fix in Web

@sfanahata
Copy link
Contributor Author

@chargome and @a-hariti - mind giving this a second set of eyes?

Copy link
Collaborator

@a-hariti a-hariti left a comment

Choose a reason for hiding this comment

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

Overall I love the end result 😍

We should just make the solution more generic and clean up the filter logic and unnecessary mutations (as per my other comments)

PS: I can implement my suggested changes if you want 🤙 @sfanahata

let title = defaultTitle;

// get rid of irrelevant platforms for the `next` path
const platformList = extractPlatforms(rootNode).filter(platform_ => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it will be a lot more freeing to switch the type of this list from "platforms" to "platforms or guides"

from there, I see two options:

  1. the nesting will either be rendered from a flat list similar to now,
    preferably with some flag indicating that it should be nested,
    which will also open the door for a more generic solution without the hardcoded JS logic

OR

  1. keep the the "platforms" type along with an inner filter over its guides, I platform would be retained in the filter if it has at least one relevant guide (the Dart/Flutter situation).
    Then adjust the rendering accordingly

I tend to prefer approach 2, much cleaner

javascriptPlatform.guides?.forEach(guide => {
const guideKey = `javascript.${guide.name}`;
if (!notSupported.includes(guideKey)) {
jsFrameworks.push({
Copy link
Collaborator

Choose a reason for hiding this comment

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

feels like a lot of repetition : )

@sfanahata
Copy link
Contributor Author

We should just make the solution more generic and clean up the filter logic and unnecessary mutations (as per my other comments)

PS: I can implement my suggested changes if you want 🤙 @sfanahata

@a-hariti - Yes please, if it doesn't feel like too much extra work, I'd love for you to take on the changes. Vibe coding obvs only gets me so far. 😊

@sfanahata
Copy link
Contributor Author

@a-hariti - any updates on progress here?

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