Skip to content

Fix the PrettyJSON hydration mismatch; close two stale backlog entries - #283

Merged
Jan0707 merged 2 commits into
mainfrom
infrastructure-improvements
Oct 20, 2026
Merged

Jan0707 merged 2 commits into
mainfrom
infrastructure-improvements

Conversation

@Jan0707

@Jan0707 Jan0707 commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

The bug

/kommt-bald and /api/cocktails logged Hydration completed but contains mismatches. in production builds, identically on main. The server never rendered the JSON tree.

vue-json-pretty has no exports map, so Node resolves it to its UMD build (lib/), and Nitro left it external. In the production server, import VueJsonPretty from 'vue-json-pretty' then resolves to { default: Tree }: a wrapper with no render function. Vue renders that as an empty comment (<!---->). The client gets the real component from Vite, builds a div, and hydration fails. A dev build is clean because Vite handles the interop there.

How it was found

  • The dev build logged nothing.
  • A production build with __VUE_PROD_HYDRATION_MISMATCH_DETAILS__ temporarily defined named the node: rendered on server: comment, expected on client: div.
  • The server HTML contained no vjs-tree at all.
  • Rendering the library directly with vue/server-renderer worked. Importing it from inside .output/server showed the wrapper.

The fix

build.transpile: ['vue-json-pretty'] in nuxt.config.ts. Vite then bundles the library into the server build and unwraps the default export.

Verification

  • Server HTML: now contains the tree (vjs-tree 6× on /kommt-bald, 74× on /api/cocktails).
  • Hydration: the details flag reports no mismatch, and a normal production build logs nothing.
  • Client tree: unchanged, at 38 and 1,699 characters of text as before.
  • Gates:

Plan updates

  • Auth console.logs: this entry was already fixed in 1edd2f2 (2026-08-04) and never ticked off. Now ticked off.
  • Fathom: the production check after Fathom: correct page attribution, track production only #279 is recorded as confirmed, with a note to hard-reload before checks like this.
  • Hydration: this fix, plus a general warning that Vue component libraries resolving to CJS/UMD in Node can fail the same way while passing every gate.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RE7Gq8fzzVAfBahzvcUqTP

Jan0707 and others added 2 commits October 20, 2026 17:25
Node resolves vue-json-pretty to its UMD build. Left external, the
server's default import was { default: Tree } rather than the
component, so SSR emitted an empty comment and hydration failed on
/kommt-bald and /api/cocktails. build.transpile lets Vite unwrap it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RE7Gq8fzzVAfBahzvcUqTP
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RE7Gq8fzzVAfBahzvcUqTP
Copilot AI balanced review requested due to automatic review settings October 20, 2026 15:25
@vercel

vercel Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
programmierbar-website Ready Ready Preview Oct 20, 2026 3:26pm UTC

Request Review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-20T15:27:08.151386Z 2ee1f40 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The narrowly scoped fix matches the diagnosed import issue, with documented production-build verification and no identified blockers.

No open issues 🎉

What changed in this PR

Fixes PrettyJSON’s production hydration mismatch by bundling vue-json-pretty for server rendering.

Changes:

  • Adds vue-json-pretty to Nuxt’s transpilation configuration.
  • Documents the fix and closes stale auth-logging and Fathom verification entries.
File Description
nuxt-app/​nuxt.config.ts Bundles the JSON viewer to correct server-side import handling.
docs/​dependency-upgrade-plan.md Records hydration diagnosis, verification, and completed backlog work.

Review effort: Balanced

@Jan0707
Jan0707 merged commit 551765f into main Oct 20, 2026
6 checks passed
@Jan0707
Jan0707 deleted the infrastructure-improvements branch October 20, 2026 15:46

This branch was successfully deployed

1 active deployment
Preview — 2ee1f400 Deployed Oct 20, 2026 by vercel[bot]
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.

2 participants