GithubHelp home page GithubHelp logo

Comments (4)

nestle49 avatar nestle49 commented on June 17, 2024

upd. isMounted inside a component solves the problem, but should we add a check everywhere? It's almost as if :style itself is defective

:style="{ paddingRight: isMounted ? ${widthCartButton + 10}px : 0 }"

upd2. Is there some kind of lifecycle hook that would indicate the end of hydration of the entire application?

from core.

yyx990803 avatar yyx990803 commented on June 17, 2024

We don't know what useElementSize is doing underneath, please provide a runnable reproduction instead of code snippets.

from core.

DaniilIsupov avatar DaniilIsupov commented on June 17, 2024

We don't know what useElementSize is doing underneath, please provide a runnable reproduction instead of code snippets.

I made minimal reproduction: https://github.com/DaniilIsupov/reproduction-hydration
In my example at App.vue I can't wait when all child components are mounted
Because of this prop.count value is being updated until hydration is complete

image

from core.

nestle49 avatar nestle49 commented on June 17, 2024

We don't know what useElementSize is doing underneath, please provide a runnable reproduction instead of code snippets.

I made minimal reproduction: https://github.com/DaniilIsupov/reproduction-hydration In my example at App.vue I can't wait when all child components are mounted Because of this prop.count value is being updated until hydration is complete

image

Yes, this is the crux of the problem

useElementSize is a VueUse helper, but that's not important

The fact is that in large difficulty applications, some components are mounted before others, which leads to hydration errors when changing some parameters depending on the client side. In my case, VueUse useElementSize passes the width from the client and causes the style attribute of the not yet mounted component to change and throws an error

However, this is very difficult to reproduce in a minimal example, since the components are mounted almost simultaneously

Therefore, when accessing a client entity in one place, we cannot be sure that all components in which changes will occur have already been mounted and hydration has been completed

from core.

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.