Skip to content
This repository was archived by the owner on Apr 6, 2023. It is now read-only.
/frameworkPublic archive

fix(nuxt): update head entry when speculation rules are updated - #9472

Merged
pi0 merged 1 commit into
mainfrom
fix/reactive-speculation-rules
Dec 5, 2022
Merged

fix(nuxt): update head entry when speculation rules are updated#9472
pi0 merged 1 commit into
mainfrom
fix/reactive-speculation-rules

Conversation

@danielroe

Copy link
Copy Markdown
Member

🔗 Linked issue

❓ Type of change

  • 📖 Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

Previously new crossorigin prefetches were not being injected into the head as it was not reactive outside a vue component. This PR fixes that by manually calling patch when necessary.

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@danielroedanielroe added bug Something isn't working 🔨 p3-minor-bug Priority 3: a bug in an edge case that only affects very specific usage labels Dec 2, 2022
@danielroedanielroe self-assigned this Dec 2, 2022
@codesandbox

Copy link
Copy Markdown

CodeSandbox logoCodeSandbox logo Open in CodeSandbox Web Editor | VS Code | VS Code Insiders

@harlan-zw

harlan-zw commented Dec 4, 2022

Copy link
Copy Markdown
Collaborator

TIL nav speculation API is a thing, looks quite interesting.

Just an FYI, with unhead 1.0.7, innerHTML objects are automatically JSON stringified, have also exported the SpeculationRules schema.

importtype{SpeculationRules}from'@unhead/schema'useHead({script: [{type: 'speculationrules',innerHTML: <SpeculationRules>{prefetch: [{source: 'list',urls: [...externalURLs.value],requires: ['anonymous-client-ip-when-cross-origin'],},],},},]})

pi0
pi0 approved these changes Dec 5, 2022
@pi0
pi0 merged commit 5fe7c1c into mainDec 5, 2022
@pi0
pi0 deleted the fix/reactive-speculation-rules branch December 5, 2022 10:46
@pi0pi0 mentioned this pull request Dec 15, 2022
6 tasks
@danielroedanielroe mentioned this pull request Jan 20, 2023
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

3.xbugSomething isn't working🔨 p3-minor-bugPriority 3: a bug in an edge case that only affects very specific usage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@danielroe@harlan-zw@pi0