Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

computed hooks is not working under certain v-if conditions #12028

Closed
sigma-plus opened this issue Sep 25, 2024 · 2 comments
Closed

computed hooks is not working under certain v-if conditions #12028

sigma-plus opened this issue Sep 25, 2024 · 2 comments

Comments

@sigma-plus
Copy link

Vue version

3.5.8

Link to minimal reproduction

https://play.vuejs.org/#eNqNVE2T0kAQ/Su9uSRUIWjpCQOrrnvQKnVLPeYym3RgdoeZ1HwAFpX/bk8nENgCSw4w0/263+uPYZ98bJrJJmAyS3JXWtl4cOhDA0ro5bxIvCuSRaHlujHWwx4s1tBCbc0aUgpLj647s256+2QaLzEruQsNhS6Ndh5qJZYwjymyWiiHo+itgy69NBrKFTHiZ+FFNtpTFMMnG6ECUtDNcCt0GwPzaaeX1NHF47pRwiPdIK/kJv5CzqJmzDvtLI/BeyL7UCpZPlN9AyvVCevgKQfk0w7GyaZdtnx6SpGMqTNUVS2XkydnNLWPNVNCopQK7Y8mVkXdmwF7ok8oZbZf2eZtwPHBXq6wfL5gf3K7aCuSB4sO7QaL5Ojzwi7Rd+77X99xR+ejc22qoAj9D+dPdEaFqLGDfQq6ItknOFb7hacr9fK3u9951O5QVBQakS3ji4SmHbt9rfRB7tvJO46jMVIXD5vyv/sX2xs8VmdL+J4A2qOtRYnwYE3jOuI4+NsZPBqjUGhCEWm3ig2D5lBhLTVySM7fi2xEuGFf71bCEu5Am2UjmC8g4/gJL9YtpG9SmEH6Oh0NsW5ltsf830yFKu9lLLI0OtNxp5EQIih/aGgbU1xf7WG3z44AvM+wkhWO+y0es4Yx/DEBtlIp6iuCX+HQQloqYgbpYGuNXt70afuF5/PL5xJTzm/id3wu+z1zUAcicTrrCoO2PXtBvVTYvJJ1n4Jn2gl/UUf34caSrsjA55Ymd8SfCLwSf6HEQyoe6LV0w/nis+f/sqT9C30RtUA=

Steps to reproduce

click hide , mutate, show in sequence, you will see the computed result is wrong!

const flagChar = computed(() => (props.flag ? '1' : '0'));

bug

What is expected?

computed result is 1 if flag is true

What is actually happening?

some optimizations in vue related to 'v-if' block the computed hooks to take place.

System Info

System:
    OS: Windows 11 10.0.22631
    CPU: (32) x64 13th Gen Intel(R) Core(TM) i9-13900HX
    Memory: 12.95 GB / 31.75 GB
  Binaries:
    Node: 20.12.2 - D:\nodejs\node.EXE
    Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 10.8.1 - D:\nodejs\npm.CMD
    pnpm: 9.6.0 - ~\AppData\Local\pnpm\pnpm.CMD
  Browsers:
    Edge: Chromium (127.0.2651.74)
    Internet Explorer: 11.0.22621.3527
  npmPackages:
    vue: ^3.4.29 => 3.5.8

Any additional comments?

When you switch the positions of flag and flagChar, the bug will disappear.

@jh-leong
Copy link
Member

Closing as a duplicate of #12020

@jh-leong jh-leong closed this as not planned Won't fix, can't repro, duplicate, stale Sep 25, 2024
@edison1105
Copy link
Member

duplicate of #12020

@github-actions github-actions bot locked and limited conversation to collaborators Oct 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants