Repository navigation
Session hydration, viewport export, Sentry sampling and auth field errors - #2052
Merged
yusuftomilola merged 2 commits intoOct 18, 2026
Merged
Conversation
…rors (Akargi) - DistinctCodes#1983: hydrate the session store once inside a client effect instead of reading the cookie at store creation / during render. Adds a `hydrated` flag, a `useSessionHydration` hook and a `useSessionToken` replacement for the old non-reactive `useAdminToken` cookie read. All render-time cookie reads on /usage, /credits, /payments, /payments/new, /payments/return and the admin pages are replaced by store-driven, hydration-gated rendering, so the first client render matches the SSR output. Cross-tab sign-out syncs via a localStorage signal + storage event listener. - DistinctCodes#1986: export `viewport` separately from `metadata` in app/layout.tsx (Next.js 14 requirement) with the same theme colour as app/manifest.ts. - DistinctCodes#1987: unify Sentry sampling in lib/sentry-sampling.ts shared by the client, server and edge configs. Default trace sampling is 1.0 in development and 0.1 in production. Session replays are opt-in only (default 0). The beforeSend hook no longer crashes on non-Error rejections: strings, undefined and plain objects are reported as NonError events with a stringified message. SENTRY_SETUP.md documents the defaults. - DistinctCodes#1988: auth API errors now carry structured field information (AuthApiError with status + fieldErrors). The auth form renders 400 validation messages next to their own input (aria-invalid, aria-describedby), maps 409 taken-email onto the email field, shows a single form-level message for 429 rate limiting, and focuses the first invalid field. Field errors clear as the user edits. Notes for reviewers: - The session-store changes are additive: `setAccessToken` and the cookie behaviour are unchanged, so sign-in and sign-out keep working exactly as before. The only new behaviour is that the token starts as null and is populated by the hydration effect. - The Sentry server/edge configs now import from lib/sentry-sampling.ts instead of hardcoding tracesSampleRate: 1.0. This changes the default production behaviour from 100% to 10% sampling. - The auth-form changes are purely additive: existing behaviour (success redirect, password confirmation mismatch) is unchanged.
|
@akargi is attempting to deploy a commit to the naijabuz's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@akargi Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
…ession model, drop cookie-hydration hook, re-add AuthApiError field errors on the shared request layer
1 task
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.
Summary
Implements the session/config/monitoring work assigned to Akargi:
hydratedflag plususeSessionHydration/useSessionTokenhooks replace the old non-reactiveuseAdminTokencookie read. All render-time cookie reads on /usage, /credits, /payments, /payments/new, /payments/return and the admin pages are replaced by store-driven, hydration-gated rendering, so the first client render matches the SSR output. Cross-tab sign-out syncs via a localStorage signal + storage event listener.viewportandthemeColorthroughmetadata, which Next 15 deprecates #1986 — Viewport export:export const viewportseparated frommetadatain app/layout.tsx (Next.js 14 requirement), same theme colour as app/manifest.ts.Test updates
Notes for reviewers
Closes #1988
Closes #1987
Closes #1986
Closes #1983