Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

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

Merged
merged 2 commits into from
Apr 29, 2022
Merged

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

merged 2 commits into from
Apr 29, 2022

Conversation

danielroe
Copy link
Member

πŸ”— Linked issue

resolves nuxt/nuxt#13397, resolves nuxt/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.

@danielroe danielroe 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 pi0 April 27, 2022 13:52
@danielroe danielroe self-assigned this Apr 27, 2022
@netlify
Copy link

netlify bot commented Apr 27, 2022

βœ… Deploy Preview for nuxt3-docs canceled.

Name Link
πŸ”¨ Latest commit 27ab914
πŸ” Latest deploy log https://app.netlify.com/sites/nuxt3-docs/deploys/62694c3e5f8a9e0009525e77

@pi0 pi0 merged commit 2a3fbb4 into main Apr 29, 2022
@pi0 pi0 deleted the fix/head-leak branch April 29, 2022 18:12
@pi0 pi0 mentioned this pull request May 2, 2022
@danielroe danielroe added the 3.x label Jan 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
3.x bug Something isn't working nuxt3 πŸ”¨ p3-minor-bug Priority 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