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

define var storeToRefs(store) HMR not work as expected #2779

Closed
Kanade-Lu opened this issue Sep 29, 2024 · 0 comments · Fixed by #2795
Closed

define var storeToRefs(store) HMR not work as expected #2779

Kanade-Lu opened this issue Sep 29, 2024 · 0 comments · Fixed by #2795
Labels
bug Something isn't working contribution welcome HMR 🔥 Related to Hot Module Replacement

Comments

@Kanade-Lu
Copy link

Reproduction

https://stackblitz.com/edit/github-k5deut?file=src%2Fstores%2Fcart.ts,src%2FApp.vue,src%2Fstores%2Fuser.ts

Steps to reproduce the bug

Open src/stores/cart.ts
Change

 test(state) {
    return state.totalNum + 1005;
  }

Check log
image

    const cart = useCartStore();
    const { test } = storeToRefs(cart);
    const testStoreToRefs = storeToRefs(cart)
    watchEffect(() => {
      console.log(
        cart.test,
        test.value,
        testStoreToRefs.test.value,
        storeToRefs(cart).test.value,
        storeToRefs(cart).test
      );
    });

Expected behavior

when use

    const { test } = storeToRefs(cart);
    const testStoreToRefs = storeToRefs(cart)

change file src/stores/cart.ts, HMR should work as cart.test(or storeToRefs(cart).test.value or storeToRefs(cart).test)

Actual behavior

when use

    const { test } = storeToRefs(cart);
    const testStoreToRefs = storeToRefs(cart)

change file src/stores/cart.ts, HMR not work as expected

Additional information

No response

@Kanade-Lu Kanade-Lu changed the title define var storeToRefs(store) will lost HMR define var storeToRefs(store) HMR not work as expected Sep 29, 2024
@posva posva added contribution welcome HMR 🔥 Related to Hot Module Replacement bug Something isn't working labels Oct 2, 2024
@github-project-automation github-project-automation bot moved this to 🆕 Triaging in Pinia Roadmap Oct 2, 2024
@posva posva moved this from 🆕 Triaging to 💬 In discussion in Pinia Roadmap Oct 2, 2024
babu-ch added a commit to babu-ch/pinia that referenced this issue Oct 8, 2024
@github-project-automation github-project-automation bot moved this from 💬 In discussion to ✅ Done in Pinia Roadmap Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working contribution welcome HMR 🔥 Related to Hot Module Replacement
Projects
Archived in project
2 participants