Hydration hint of a component with no name is rejected (400 Invalid payload) and surfaces as an unhandled error
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 78/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- nuxt, typescript
- Ambito
- devtools, observability
Direzione di ricerca
Inizia in src/runtime/hydration/composables.ts, in corrispondenza della chiamata al report di hydration, e in src/runtime/hydration/handlers.ts, in corrispondenza di assertPayload. Segui come un componente senza nome raggiunge il payload e come viene gestito un report rifiutato. Il lavoro è completato quando l’indicazione può essere memorizzata per la riproduzione fornita, composta solo da un template, e un report non riuscito non diventa un errore non gestito; l’issue non indica alcun file di test da eseguire.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Environment
- nuxt 4.6.2 (SSR, dev mode)
- @nuxt/hints 1.1.5 (also checked against
main: same code) - vue 3.5.44
- Node.js 26.13.0, Windows 11
Reproduction
A page with no <script setup> (template only), whose HTML differs between server and client, pages/repro.vue:
<template>
<div>{{ Date.now() }}</div>
</template>
Open /repro in dev mode.
Describe the bug
The hydration hint for that page is never stored, and an unhandled error opens Nuxt's dev error overlay:
FetchError: [POST] "/__nuxt_hints/hydration": 400 Invalid payload
Why it happens (src/runtime/hydration/composables.ts):
componentName = instance.type.name ?? instance.type.displayName ?? instance.type.__name. A component with none of the three (a template-only SFC, which gets no__name) sendscomponentName: undefined. I logged the rejected body:componentNameisundefined,fileLocationis the page path, both HTML fields are strings.- The server handler rejects it:
assertPayloadrequirestypeof body.componentName === 'string'(src/runtime/hydration/handlers.ts). - The
$fetch(HYDRATION_ROUTE, …).then(…)call has no.catch, so the rejection becomes an unhandled error.
Side effect: the dev error overlay (nuxt-error-overlay) contains a <main>, so accessibility checks run on the page (axe landmark-no-duplicate-main) report two main landmarks.
Expected: the hint is stored and shown in the DevTools panel like the others, and a failed report does not surface as an unhandled error.
Suggestion:
- fall back to a name derived from
__file(e.g. the file's base name) or a placeholder like'Anonymous'whenname,displayNameand__nameare all missing; - and/or add a
.catchto the report call that logs a warning instead of throwing.
Additional context
Found while triaging the hydration hints of an app together with #409 (a different false positive in the same check).
Logs
FetchError: [POST] "/__nuxt_hints/hydration": 400 Invalid payload
at async $fetch2 (.../ofetch/dist/shared/ofetch.CWycOUEr.mjs:332:15)
- Lingua principale
- TypeScript
- Stelle
- 347
- Fork
- 15
- Merge medio
- 7m
- PR unite (30g)
- 1
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di nuxt/hints
-
Hydration hint false positive: `class=""` appears on dynamic components with an undefined classForse già presa @lafllamme l’ha presa 5 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 1 giorno
-
RefrenceError on start upApertaneed reproduction
Difficoltà 4/5 3-5 giorni Idoneità per principianti 30/100
nuxt/hints#277 · 1 commento · 2 reazioni ·
I maintainer di solito rispondono entro 1 giorno
-
Make hydration diff more preciseForse di nuovo libera @huang-julien l’ha presa 259 giorni fa e non c’è nessuna pull request aperta. Aperta
nuxt/hints#257 · 1 commento · 2 reazioni · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Assets Hints for improved performanceForse di nuovo libera @Baroshem l’ha presa 296 giorni fa e non c’è nessuna pull request aperta. Aperta
nuxt/hints#199 · 3 commenti · 2 reazioni · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: Search input loses focus while typing on the Inventory, Reservations and Locations lists (view_configurations enabled)Forse già presa @medusa-os-bot l’ha presa oggi. Apertastatus: needs triaging type: bug version: 2.0
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
medusajs/medusa#17886 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 95/100
marimo-team/marimo#11949 ·
I maintainer di solito rispondono entro 1 giorno
-
bug server-time v2
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
modelcontextprotocol/servers#5559 ·
I maintainer di solito rispondono entro 1 giorno
-
D1 Time Travel restore help advertises 30 days without a plan qualifierForse già presa @akhil9tiet l’ha presa oggi. Apertabug package:wrangler product:d1
Difficoltà 1/5 1-3 ore Idoneità per principianti 78/100
cloudflare/workers-sdk#17000 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno