Code Monkey home page Code Monkey logo

Comments (8)

harlan-zw avatar harlan-zw commented on July 20, 2024 3

Available in https://github.com/vueuse/head/releases/tag/v0.8.0, will be shipped to Nuxt in the next few days

from head.

atodd avatar atodd commented on July 20, 2024 2

I was able to workaround this by calling useHead in middleware. I was originally setting it in a layout file, so moving the call further up the execution stack works. Not sure why this matters, but hope it helps.

from head.

tylerforesthauser avatar tylerforesthauser commented on July 20, 2024 1

was able to workaround this by calling useHead in middleware. I was originally setting it in a layout file, so moving the call further up the execution stack works. Not sure why this matters, but hope it helps.

This most definitely helps! I moved my offending useHead declaration from app.vue to a plugin (note: using the vue:setup hook) and it works like a charm. Thanks for the tip!

from head.

ffxsam avatar ffxsam commented on July 20, 2024

@antfu Hey Anthony, any ideas on why this is happening and how to resolve it? Unfortunately nuxt/bridge#277 didn't address the issue.

from head.

ffxsam avatar ffxsam commented on July 20, 2024

Here's a possibly dumb idea:

What if we just debounced updateDOM()? This is what's happening:

  1. Server populates the head with proper styles
  2. Client begins hydrating
  3. The first couple updateDOM() calls don't have everything yet
  4. updateDOM() is called several times in a row, and by the last update, all head items are present

Does updateDOM() really need to set the head a bunch of times in a row? I made my own local patch and I'm debouncing updateDOM() by 500ms. This fixes the background color flash.

This feels pretty hacky to me, so I'm sure there's a better way.

from head.

atodd avatar atodd commented on July 20, 2024

Also running into the same issue using vueuse/head: 0.7.9 in nuxt: 3.0.0-rc.8.

from head.

ffxsam avatar ffxsam commented on July 20, 2024

The workaround doesn't work for me, unfortunately, since I don't have enough data in the middleware to actually populate the head.

from head.

harlan-zw avatar harlan-zw commented on July 20, 2024

Temporary workaround using a debounce function seems to solve it: #78 (comment), will need to investigate if there's something more elegant

from head.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.