Skip to content

Conversation

onurtemizkan
Copy link
Collaborator

@onurtemizkan onurtemizkan commented Aug 28, 2025

Added react-router wizard, similar to our remix wizard

Copy link

github-actions bot commented Aug 28, 2025

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against fe09a64

Copy link

codecov bot commented Aug 28, 2025

Codecov Report

❌ Patch coverage is 44.30380% with 616 lines in your changes missing coverage. Please review.
✅ Project coverage is 32.96%. Comparing base (cf911af) to head (fe09a64).
⚠️ Report is 8 commits behind head on master.

Files with missing lines Patch % Lines
src/react-router/react-router-wizard.ts 0.36% 274 Missing ⚠️
src/react-router/sdk-setup.ts 33.33% 138 Missing ⚠️
src/react-router/codemods/server-entry.ts 62.79% 94 Missing and 2 partials ⚠️
src/react-router/templates.ts 36.58% 78 Missing ⚠️
src/react-router/codemods/root.ts 90.37% 13 Missing ⚠️
src/react-router/sdk-example.ts 88.46% 6 Missing ⚠️
src/run.ts 0.00% 5 Missing ⚠️
lib/Constants.ts 20.00% 4 Missing ⚠️
src/react-router/codemods/utils.ts 80.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1076      +/-   ##
==========================================
+ Coverage   32.06%   32.96%   +0.90%     
==========================================
  Files         133      141       +8     
  Lines       15638    16802    +1164     
  Branches     1093     1205     +112     
==========================================
+ Hits         5014     5539     +525     
- Misses      10607    11244     +637     
- Partials       17       19       +2     
Flag Coverage Δ
unit-tests 32.96% <44.30%> (+0.90%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@onurtemizkan onurtemizkan force-pushed the onur/reactrouter-framework-wizard branch from e0a23a8 to 9e3cca6 Compare August 28, 2025 15:35
@onurtemizkan onurtemizkan force-pushed the onur/reactrouter-framework-wizard branch from 1baebe3 to 80a9605 Compare September 1, 2025 18:10
@onurtemizkan onurtemizkan marked this pull request as ready for review September 1, 2025 18:58
@onurtemizkan onurtemizkan requested a review from Lms24 September 1, 2025 18:58
@Lms24 Lms24 requested a review from andreiborza September 10, 2025 09:18
tracesSampleRate: 1,
enableLogs: true,

integrations: [browserTracingIntegration({
Copy link
Member

Choose a reason for hiding this comment

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

q: Why are we expecting the browserTracingIntegration? I don't see this in the docs.

);
} catch (e) {
clack.log.warn(
`Could not initialize Sentry on client entry.\n Please do it manually using instructions from https://docs.sentry.io/platforms/javascript/guides/react-router/`,
Copy link
Member

Choose a reason for hiding this comment

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

m: In the other wizard we print what users have to add if steps fail. We should do the same for all of these.

Comment on lines 92 to 96
clack.log.warn(
`Could not find ${chalk.cyan(
clientEntryFilename,
)}. Skipping client entry instrumentation.`,
);
Copy link
Member

Choose a reason for hiding this comment

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

m: I think we could ask users if they want to try rerunning reveal and if that still didn't work then print out what they have to add to the entry.client file.

Comment on lines 124 to 128
await showCopyPasteInstructions({
filename: clientEntryFilename,
codeSnippet: sentryInitCode,
hint: 'Add this code at the top of your client entry file',
});
Copy link
Member

Choose a reason for hiding this comment

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

Let's move this into the outer catch and just rethrow here so we always get these instructions when having to paste.

Comment on lines 146 to 150
clack.log.warn(
`Could not find ${chalk.cyan(
rootFilename,
)}. Skipping root route instrumentation.`,
);
Copy link
Member

Choose a reason for hiding this comment

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

m: Same as above, I think we could ask users if they want to try rerunning reveal and if that still didn't work then print out what they have to add to the root file.

Comment on lines 266 to 269
clack.log.warn(
`Failed to read ${chalk.cyan(
serverFile,
)}. Checking next server file...`,
Copy link
Member

Choose a reason for hiding this comment

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

m: I think we shouldn't surface this to the user, it's not actionable.

Comment on lines 259 to 262
clack.log.warn(
`Failed to automatically update ${chalk.cyan(serverFile)}.`,
);
// Continue to next file instead of returning false immediately
Copy link
Member

Choose a reason for hiding this comment

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

m: I think we should change this logic to not continue.

We found a file so it's likely the actual file users are using and continuing on doesn't seem fruitful.

We should bale out of the loop and show a pasteable snippet instead for the error case.

Comment on lines 286 to 290
clack.log.warn(
`Could not find ${chalk.cyan(
serverEntryFilename,
)}. Skipping server entry instrumentation.`,
);
Copy link
Member

Choose a reason for hiding this comment

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

m: As above, we could give users the option to reveal again and if that fails show a pasteable snippet.

Comment on lines 321 to 325
await showCopyPasteInstructions({
filename: serverEntryFilename,
codeSnippet: sentryServerCode,
hint: 'Add this error handling to your server entry file',
});
Copy link
Member

Choose a reason for hiding this comment

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

m: Let's move this to the outer catch and rethrow here.


if (enableTracing) {
integrations.push(
'browserTracingIntegration({\n useEffect,\n useLocation,\n useNavigate\n })',
Copy link
Member

Choose a reason for hiding this comment

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

m: I think we're supposed to use the reactRouterTracingIntegration instead.

Copy link
Member

Choose a reason for hiding this comment

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

@onurtemizkan the integration also doesn't need the hooks to be passed in

});
} catch (e) {
clack.log.warn(
`Could not configure Vite plugin for sourcemap uploads. Please configure it manually using instructions from https://docs.sentry.io/platforms/javascript/guides/react-router/sourcemaps/`,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
`Could not configure Vite plugin for sourcemap uploads. Please configure it manually using instructions from https://docs.sentry.io/platforms/javascript/guides/react-router/sourcemaps/`,
`Could not configure Vite plugin for sourcemap uploads. Please configure it manually using instructions from https://docs.sentry.io/platforms/javascript/guides/react-router/#source-maps-upload`,

return false;
}

export async function instrumentSentryOnEntryServer(
Copy link
Member

Choose a reason for hiding this comment

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

h: We also need to update the default export here (handleRequest), otherwise there will be no distributed tracing

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.

3 participants