fix: wrap login page in Suspense boundary#29
Merged
TerrifiedBug merged 1 commit intomainfrom Mar 7, 2026
Merged
Conversation
PR #28 added useSearchParams() to the login page for SSO error messages, but Next.js requires a Suspense boundary around components using this hook or static prerendering fails during build.
Contributor
Greptile SummaryThis PR fixes a Next.js static prerendering failure on
Confidence Score: 5/5
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[next build] --> B[LoginPage\ndefault export]
B --> C[Suspense boundary\nfallback: Card + Loader2 spinner]
C -->|Loading| D[Fallback spinner rendered]
C -->|Resolved| E[LoginPageContent]
E --> F[useSearchParams]
E --> G[useRouter]
F --> H{error param present?}
H -->|Yes| I[setError with SSO_ERROR_MESSAGES\nreplaceState to clean URL]
H -->|No| J[Normal login form render]
E --> K{checkingSetup?}
K -->|True| L[Inline spinner card]
K -->|False| M[Full login / TOTP / SSO form]
Last reviewed commit: 6fdfefe |
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
useSearchParams()to the login page for SSO error messages, which requires a<Suspense>boundary in Next.js or static prerendering fails during build<Suspense>fallback with the existing loading spinnerRoot cause
useSearchParams()without a Suspense boundary causes Next.js to bail out of static generation duringnext build, resulting in the prerender error on/login.Test plan
pnpm buildpasses —/loginprerendered as static content