Skip to content

SSR restored#340

Merged
brucetony merged 3 commits intodevelopfrom
339-enable-ssr
Mar 9, 2026
Merged

SSR restored#340
brucetony merged 3 commits intodevelopfrom
339-enable-ssr

Conversation

@brucetony
Copy link
Collaborator

@brucetony brucetony commented Mar 9, 2026

After upgrading to Nuxt 4, SSR was no longer working. This was due to certain refs that needed to be computed instead. This was always a bug, but until Nuxt 4, it was a silent issue, but now has been fixed

Summary by CodeRabbit

  • Improvements
    • Avatar menu now updates dynamically to show appropriate login/logout options and icons based on authentication state; includes a loading placeholder.
    • Server-side rendering is enabled in production and disabled in development to match environment needs.
    • Server-side authentication checks simplified by relying on existing middleware.

@brucetony brucetony linked an issue Mar 9, 2026 that may be closed by this pull request
@coderabbitai
Copy link

coderabbitai bot commented Mar 9, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 00d60425-94b0-4ab8-8e4c-75716774cdfc

📥 Commits

Reviewing files that changed from the base of the PR and between 0c7c738 and e35d315.

📒 Files selected for processing (1)
  • app/components/header/AvatarButton.vue

📝 Walkthrough

Walkthrough

Refactors the avatar menu to compute menu items from authentication state at render time and updates Nuxt config to enable SSR except in development and to disable server-side auth in favor of global middleware.

Changes

Cohort / File(s) Summary
Avatar Menu Reactivity
app/components/header/AvatarButton.vue
Replaced menuItems ref with a computed that inlines label/icon logic based on isAuthenticated; removed separate userActionLabel/userActionIcon constants; added a loading-state placeholder in the template.
Environment-Based Configuration
nuxt.config.ts
Changed ssr to process.env.NODE_ENV !== "development" and set auth.disableServerSideAuth to true (comment notes global middleware handles auth).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐇 I compute my menu where the state is seen,
Labels and icons spring alive, not preened.
SSR wakes up outside dev's small den,
Middleware hums — the app hops again. 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'SSR restored' is directly related to the main objective of the PR, which is fixing server-side rendering after a Nuxt 4 upgrade.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 339-enable-ssr

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@app/components/header/AvatarButton.vue`:
- Around line 29-30: The icons are inverted for the action in AvatarButton.vue:
where the object sets label and icon using isAuthenticated.value, swap the icon
strings so they match the labels — when isAuthenticated.value is true (label
"Logout") use the sign-out icon (e.g., "pi pi-sign-out"), and when false (label
"Login") use the sign-in icon (e.g., "pi pi-sign-in"); update the icon
assignment alongside the existing label assignment to keep them consistent.

In `@nuxt.config.ts`:
- Around line 34-35: AvatarButton.vue currently computes isAuthenticated as
authStatus.value === "authenticated" and treats any other state (including
"loading") as logged-out, causing a flash; modify AvatarButton.vue to explicitly
handle the "loading" authStatus (or preserve previous known state) instead of
rendering the question-mark logged-out UI: update the computed/isAuthenticated
logic to check for authStatus.value === "loading" and return a third state
(e.g., "loading"/null) or use a separate isLoading reactive, then render a
skeleton/placeholder or reuse the last authenticated UI while loading; ensure
references to computed isAuthenticated and authStatus are updated so the
template displays the loading placeholder rather than the logged-out view.
- Line 7: The current nuxt config sets ssr based on NODE_ENV (ssr:
process.env.NODE_ENV !== "development"), which disables SSR in local dev and
hides SSR regressions; change this to use an explicit opt-out flag so devs run
SSR by default — replace the NODE_ENV check with a boolean derived from a
dedicated env var (e.g., NUXT_SSR_DISABLED) and set ssr to true unless that flag
is explicitly "true" (update the ssr assignment in nuxt.config.ts accordingly,
referencing the ssr property and the new process.env.NUXT_SSR_DISABLED
variable).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 15fd0d8e-f35b-49f1-b486-88e547d6b70e

📥 Commits

Reviewing files that changed from the base of the PR and between 64098f7 and 0c7c738.

📒 Files selected for processing (2)
  • app/components/header/AvatarButton.vue
  • nuxt.config.ts

@brucetony brucetony merged commit 1b79119 into develop Mar 9, 2026
5 checks passed
@brucetony brucetony deleted the 339-enable-ssr branch March 9, 2026 12:04
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.

Enable SSR

1 participant