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

fix(nuxt): mark config head as non-reactive - #4666

Merged
pi0 merged 2 commits into
mainfrom
fix/head-leak
Apr 29, 2022
Merged

fix(nuxt): mark config head as non-reactive#4666
pi0 merged 2 commits into
mainfrom
fix/head-leak

Conversation

@danielroe

Copy link
Copy Markdown
Member

🔗 Linked issue

resolvesnuxt/nuxt#13397, resolvesnuxt/nuxt#13847

❓ 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

In general using reactive objects outside of a Vue context is dangerous. This PR marks the nuxt configuration head inserted by Nuxt as non-reactive, which avoids a memory leak, as well as tidying up a bit of leftover bridge compatibility.

There seems ample space here for future improvement as well, including:

  • identifying if there's something in vueuse/head implementation (or in our practice of reffing up the head values)
  • detecting if useHead is being called outside of a vue context (that is, in a plugin) and marking entries as non-reactive if they aren't already refs/reactive.

📝 Checklist

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

@danielroedanielroe added bug Something isn't working nuxt3 🔨 p3-minor-bug Priority 3: a bug in an edge case that only affects very specific usage labels Apr 27, 2022
@danielroe
danielroe requested a review from pi0April 27, 2022 13:52
@danielroedanielroe self-assigned this Apr 27, 2022
@netlify

netlifyBot commented Apr 27, 2022

Copy link
Copy Markdown

Deploy Preview for nuxt3-docs canceled.

NameLink
🔨 Latest commit27ab914
🔍 Latest deploy loghttps://app.netlify.com/sites/nuxt3-docs/deploys/62694c3e5f8a9e0009525e77

pi0
pi0 approved these changes Apr 29, 2022
@pi0
pi0 merged commit 2a3fbb4 into mainApr 29, 2022
@pi0
pi0 deleted the fix/head-leak branch April 29, 2022 18:12
@pi0pi0 mentioned this pull request May 2, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

3.xbugSomething isn't workingnuxt3🔨 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.

useHead memory leak memory leak with useHead

2 participants

@danielroe@pi0