Skip to content

watchEffect within effectScope() stops working after navigating away from then back to component #7606

@franck102

Description

@franck102

Reproduction

Playground SFC

Steps to reproduce the bug

  1. Navigate to the TestView component in the browser
  2. Click the button, testData count property is incremented
  3. Navigate away from it (staying in the SPA)
  4. Navigate back to TestView

Expected behavior

The button should cause testData.count to be incremented, even after re-mounting the component.

Actual behavior

After navigating back to the component clicking the button updates the refresher, but not testData

testStore.js?t=1675088280233:17 Refresher: 0.05272026601141877
testStore.js?t=1675088280233:11 Watch effect running 0.05272026601141877
testStore.js?t=1675088280233:17 Refresher: 0.937791768731258
testStore.js?t=1675088280233:11 Watch effect running 0.937791768731258
# Navigate away
logger.js:197 [Router] BeforeEach /passes
logger.js:197 [Router] AfterEach: /passes
# Then back
logger.js:197 [Router] BeforeEach /test
logger.js:197 [Router] AfterEach: /test
testStore.js?t=1675088280233:17 Refresher: 0.558079237843816
testStore.js?t=1675088280233:17 Refresher: 0.31739197899941574

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions