Repository navigation
fix(nextjs): Create root layout for example page if it doesn't exist - #863
Merged
Merged
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #863 +/- ##
==========================================
+ Coverage 51.50% 51.55% +0.05%
==========================================
Files 53 53
Lines 3633 3637 +4
Branches 854 857 +3
==========================================
+ Hits 1871 1875 +4
Misses 1632 1632
Partials 130 130
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Lms24
marked this pull request as ready for review
March 18, 2025 14:25
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds a check for a NextJS root layout file. Some NextJS apps don't have a root layout though, for instance if they only serve API routes. If users still would like to create an example page via the wizard, we also need to add a root layout so that the page can be rendered.
I noticed that newer versions actually create a root layout file automatically in dev mode when first serving the page but this doesn't apply to older NextJS versions. So it's better to handle this explicitly in the wizard. The file we inject is almost identical to the auto-generated one, just with some Sentry-specific text.
This is tested by removing the root layout in our NextJS 14 E2E test app and assuring that it's re-added by our wizard in the tests.
closes #607