-
Notifications
You must be signed in to change notification settings - Fork 7
Don't do the getInitialProps work for logged out users #1303
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
Conversation
📝 WalkthroughWalkthroughAdds an early authentication check in Next.js SSR to short-circuit data fetching for unsigned users and consolidate auth values (signedIn/admin/accessToken), and updates a Redis GraphQL cache test TTL from 1 hour to 5 hours. Changes
Sequence Diagram(s)sequenceDiagram
participant Browser
participant NextJS as Next.js (getInitialProps)
participant Auth as Auth helpers (isSignedIn/getAccessToken)
participant Apollo as Apollo init
Browser->>NextJS: request page (SSR)
NextJS->>Auth: isSignedIn(ctx)
alt user not signed in
Auth-->>NextJS: false
NextJS->>Apollo: initialize with apolloState
NextJS-->>Browser: return minimal pageProps (currentUser:null, apolloState, accessToken)
else user signed in
Auth-->>NextJS: true + accessToken
NextJS->>Apollo: populate SSR queries with accessToken
NextJS->>Component: call Component.getInitialProps(ctx)
NextJS-->>Browser: return populated pageProps + apolloState + accessToken
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
🔇 Additional comments (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1303 +/- ##
==========================================
+ Coverage 62.59% 66.31% +3.71%
==========================================
Files 153 154 +1
Lines 6422 6460 +38
Branches 1579 1591 +12
==========================================
+ Hits 4020 4284 +264
+ Misses 2244 2037 -207
+ Partials 158 139 -19
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:
|
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.