`useHead` does not resolve reactive input on the client
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 74/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 静か
- 技術スタック
- nuxtjs, typescript
調査の方向性
src/runtime/composables/head.ts から始め、@unhead/vue の clientUseHead の動作と watchEffect ベースの解決を確認しながら、activeHead.push() と patch() の各アクティブな箇所を調べます。リンクされた再現コードを使って、リアクティブな props がクライアントで解決され、refs が変更されると更新され、head タグが DOM に到達するのをもはや妨げないことを確認します。
索引モデルが issue の本文から書いたものです。
説明
🐛 The bug
The module's useHead replacement (src/runtime/composables/head.ts) never resolves reactive input. All of its activeHead.push() / patch() sites hand the raw object to unhead, while @unhead/vue's own clientUseHead runs walkResolver(input, VueResolver) inside a watchEffect.
This only bites on the client: @unhead/vue/server creates the head with propResolvers: [VueResolver], so refs resolve inside unhead during SSR. The client head has no prop resolver, so resolution exists only in the composable this module replaces.
Two consequences:
-
Crash — a ref on
innerHTML/textContentof astyle/scriptreaches unhead'snormalizeProps, which JSON-stringifies object values:TypeError: Converting circular structure to JSON --> starting at object with constructor 'ComputedRefImpl' | property 'dep' -> object with constructor 'Dep' --- property 'computed' closes the circle at JSON.stringify (<anonymous>) at normalizeProps (unhead.js:148:28) at normalizeTag (unhead.js:175:15) at normalizeEntryToTags (unhead.js:209:56) at resolveTags (unhead.js:362:16) at _renderDOMHead (unhead.js:183:21)It is thrown inside the debounced
_renderDOMHead, so the whole head render is abandoned: the tag never lands in the DOM, and it can abort router start. -
Silent, for every other prop: the ref object is used instead of its
.value, and since there is nowatchEffect, the tag never updates when the ref changes. Client-side reactive head does not work, though unhead v3 documents it as supported.
@nuxt/ui triggers case 1 out of the box: its colors plugin calls useHead({ style: [{ innerHTML: root, id: 'nuxt-ui-colors' }] }) where root is a computed. Any @nuxtjs/ionic + @nuxt/ui app loses its theme colors style. @nuxtjs/i18n's useLocaleHead() and @nuxtjs/seo hit case 2.
🛠️ To reproduce
https://github.com/Carpediem94/nuxt-ionic-head-repro
🌈 Expected behaviour
Reactive input resolved before being pushed to unhead, and kept in sync as it changes, matching the behaviour of @unhead/vue's useHead.
ℹ️ Additional context
@nuxtjs/ionic 1.0.2, nuxt 4.5.2, @unhead/vue 3.3.1, @nuxt/ui 4.10.0.
Same error class as https://github.com/unjs/unhead/issues/869, but that fix only covered the SSR streaming serializer.
- 主要言語
- TypeScript
- スター
- 457
- フォーク
- 53
- 平均マージ
- 15時間 54分
- マージ済み PR(30日)
- 25
環境構築
このプロジェクトの環境構築ファイルはまだ確認していません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
nuxt-modules/ionic のほかの issue
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
nuxt-modules/ionic#908 · リアクション 2 件 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 35/100
nuxt-modules/ionic#867 ·
メンテナーはふだん 1 日以内に返信
-
bug needs reproduction
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
nuxt-modules/ionic#696 ·
メンテナーはふだん 1 日以内に返信
-
IonCardオープンbug
難易度 3/5 1〜2日 初心者へのやさしさ 25/100
nuxt-modules/ionic#610 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 30/100
nuxt-modules/ionic#603 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
nuxt-modules/ionic の issue をすべて見る
似ている issue
-
refactor
難易度 2/5 半日 初心者へのやさしさ 84/100
メンテナーはふだん 5 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
OHDSI/Data2Evidence#3450 ·
メンテナーはふだん 2 日以内に返信
-
e2e-failure ready-to-code
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
redhat-developer/rhdh-plugin-export-overlays#4011 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
automation missing-model model-sync provider:ofox
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
anomalyco/models.dev#8421 ·
メンテナーはふだん 1 日以内に返信
-
SlackAdapter and TelegramAdapter are not assignable to Adapter under exactOptionalPropertyTypesオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信