GithubHelp home page GithubHelp logo

Comments (4)

posva avatar posva commented on April 28, 2024

As noted in the following comments, the current behavior is expected: vuejs/core#1209 (comment)

from vue.

LinusBorg avatar LinusBorg commented on April 28, 2024

@posva OP also opened this issue in the core repo, and there I noted that there is one weird thing: watch(aShallowRef, ...) does trigger the watch. Normal refers, or getter functions, don't. So only when you watch a shallowRef directly, it will be triggered.

This seeems to be by design, but I question the wisdom of that design. See vuejs/core#9579 (comment)

Should we consider re-opening this issue here until we settled the raised question over in core?

from vue.

undergroundwires avatar undergroundwires commented on April 28, 2024

Hi, sorry for the duplication, I got confused and opened two issues.

I'd appreciate at least there would be some documentation regarding this. I've updated my application to use watch(aShallowRef to get this working for now.

A trivia: All of the major language models I asked for help including GPT 4.0 is confused about this behavior and expects watch(() => aShallowRef.value) to be triggered, not only humans 🙂

from vue.

posva avatar posva commented on April 28, 2024

I think having one is core is enough but I think current behavior makes more sense: when you pass a getter, if the returned value do not change, the watcher shouldn’t trigger

from vue.

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.