$subscribe triggered when unrelated store used for first time in child component (Vue 2)

This issue has been created since 2022-10-31.

Reproduction

https://codesandbox.io/s/pinia-store-usage-in-child-component-triggers-subscribe-in-different-unrelated-store-nvhwq8

https://jsfiddle.net/posva/z0qbvLr3/

Steps to reproduce the bug

Click on change

Expected behavior

The watcher doesn't trigger

Actual behavior

The watcher triggers

posva wrote this answer on 2022-10-31

This seems to happen with plain Vue 2: https://jsfiddle.net/posva/z0qbvLr3/ but not with Vue 3

it might be a limitation of the reactivity system not using Proxies... I moved it to vue repo just in case

yyx990803 wrote this answer on 2022-11-09

This is an edge case due to Vue 2's new property addition check working differently compared to Vue 3.

In Vue 3 we use Proxy for proper detection, but in Vue 2 we do this by registering the parent object itself as the change source. The deep flag is also causing the watch callback to always run as long as any dependency change. So unfortunately this is an edge case due to Vue 2's reactivity limitations.

More Details About Repo
Owner Name vuejs
Repo Name vue
Full Name vuejs/vue
Language TypeScript
Created Date 2013-07-29
Updated Date 2022-12-10
Star Count 201155
Watcher Count 6070
Fork Count 33134
Issue Count 595

YOU MAY BE INTERESTED

Issue Title Created Date Comment Count Updated Date
[Bug] Share button in the top right of application pages sometimes doesnt appear 1 2021-12-28 2022-12-04
Feature Request - Add tags and modify comments of annotations 8 2022-05-01 2022-10-16
Missing git tag for 1.5.3 2 2022-05-02 2022-11-03
Arch/Linux installation note for puppeteer EACCES error 2 2018-11-08 2022-10-27
Optional chaining syntax missing from `eventType.seatsPerTimeSlot` 3 2022-06-20 2022-09-21
Error calling Reload/Reset with vim-polyglot 1 2021-07-06 2022-10-20
Enabling no-prototype-builtins ESLint rule? 0 2020-08-28 2022-11-18
[BUG] Sorting issues in Part BOM when non-latin chars are in part names 4 2022-07-14 2022-10-03
Resident Evil 5 does not work 1 2021-01-23 2022-11-19
Red Dead Redemption 2 doesn't run on this build 17 2020-11-14 2022-10-09
Grand Theft Auto V does not work 0 2021-01-23 2022-10-09
The checkbox "Enable Steam Play for all other titles" stays disabled after restart 1 2021-01-01 2022-10-17
Proton only utilizes integrated graphics 2 2021-01-17 2022-07-08
Missing binding : SetCursor? 1 2022-05-26 2022-11-14
uslugirozwojowe.parp.gov.pl 0 2022-02-08 2022-12-06
Does not build on Go 1.17 5 2021-08-18 2022-11-25
hurl 1.8.0 release build issue 3 2022-11-04 2022-12-05
ClassicFooter底部显示bug,两个项目 一样用法,一个显示正在加载中,一个显示上拉加载更多 ... 1 2022-07-13 2022-10-26
oauth_access returning not_allowed_token_type 3 2020-06-29 2022-12-05
ldd is broken in default install (missing dependency on bash) 5 2021-11-29 2022-11-05
virtual-list 没有 renderHeader 0 2021-09-28 2022-10-31
Color.hex has incorrect math 2 2021-01-08 2022-12-08
Search should search through contents, not just TOC 2 2021-04-15 2022-12-01
geemap.ee_to_geopandas allow more than 5,000 features 1 2022-10-15 2022-11-22
Markers with different shapes 6 2022-10-13 2022-11-22
For some files, the ~ symbol will always be displayed 1 2021-11-12 2022-11-02
allure-results does not exists 54 2018-03-07 2022-12-01
Render alias of widgets as an ID tag to enable anchoring 1 2021-06-22 2022-11-06
Shadow Depth not applied to DrawerHost in both modes 0 2022-08-05 2022-10-25
pxl script execution error when 'select' includes req_body for http_events 3 2022-03-29 2022-11-26
Self Hosted Pixel Cloud on EKS. Deployment fails with some pods entering CrashLoops 4 2022-03-30 2022-11-26
Drag and drop intermittently fails on Windows UWP WebView/WebView2 2 2022-03-15 2022-11-13
Fix navigation with hardware keyboards 0 2022-01-08 2022-08-14
Introduce `StatusAddress` component 1 2021-09-27 2022-11-06
setRecoilState requires re-rendering 1 2022-08-26 2022-11-10
Forever progress "Initializing ESLint Server" 1 2021-10-13 2022-12-09
No GSettings schemas are installed on the system (pkgs.onlykey) 3 2022-07-14 2022-11-07
when opening on minecraft launcher it doesnt work 1 2022-07-31 2022-11-03
Clarify multi-threading options 0 2021-02-18 2022-11-20
Unify single/or conditions query init and add tests for or/array LIKE 1 2020-03-28 2022-11-17
集成 com.github.CarGuo:GSYRecordWave:1.1.8 这个录音项目后闪退 1 2022-08-11 2022-12-01
data/shaders/chapter06/imgui_multi.frag missing? 2 2022-10-24 2022-12-01
Failed to `order_by` date error 0 2021-03-26 2022-11-23
Migrate from Bower 4 2017-08-20 2021-12-31
Buttons in bottomView don't seem to work 5 2017-03-16 2022-12-08
[FEATURE REQUEST] Don't redirect from http to https on bootstrap/repo sites, use https only 0 2021-08-25 2022-11-02
Caddy v.2.4.4 breaks Nextcloud caldav sync 2 2021-09-02 2022-11-19
Include Bintray plugin repository 0 2021-02-17 2022-11-04
Daily Failure Change rate is not reflecting in Grafana Dashboard [CI/CD is Gitlab] 1 2022-03-28 2022-11-13
Source Generators - make WriteTo public for Syntax classes 11 2022-10-21 2022-10-16