-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
feat(reactivity): base watch
, getCurrentWatcher
, and onWatcherCleanup
#9927
feat(reactivity): base watch
, getCurrentWatcher
, and onWatcherCleanup
#9927
Conversation
f3e5303
to
7c5f05a
Compare
Regarding the API design of If you have any better design suggestions, please put them forward here. I am very happy to listen your suggestions. |
e550ce9
to
770c21d
Compare
Size ReportBundles
Usages
|
I created another separate PR #10173 for |
onEffectCleanup
and baseWatch
baseWatch
2ef9594
to
589cd11
Compare
baseWatch
baseWatch
and onWatcherCleanup
Due to the obvious difference between |
34e750f
to
a5769e1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kevin suggested that I move the types and enums related to scheduler in baseWatch
into a separate file in reactivity, hence this Commit.
Why not pass the cleanup function as the third argument? |
dad9d0f
to
7fbdc6e
Compare
Squashed commit of the following: commit dad9d0f Author: Rizumu Ayaka <rizumu@ayaka.moe> Date: Thu Mar 14 20:35:19 2024 +0800 feat: scheduler in reactivity commit 406c750 Author: Rizumu Ayaka <rizumu@ayaka.moe> Date: Thu Mar 14 14:08:12 2024 +0800 fix: revert export alias commit 74996b6 Author: Rizumu Ayaka <rizumu@ayaka.moe> Date: Wed Mar 13 22:21:27 2024 +0800 test: onWatcherCleanup in apiWatch commit a5769e1 Author: Rizumu Ayaka <rizumu@ayaka.moe> Date: Wed Mar 13 22:09:43 2024 +0800 fix: remove elusive code for once commit 589cd11 Author: Rizumu Ayaka <rizumu@ayaka.moe> Date: Wed Mar 13 21:14:34 2024 +0800 fix: errors related to immediateFirstRun commit 3694745 Author: Rizumu Ayaka <rizumu@ayaka.moe> Date: Tue Mar 12 18:16:52 2024 +0800 refactor: rename to onWatcherCleanup, getCurrentWatcher, remove middleware commit b3f45d2 Merge: 60a1b97 9a936aa Author: Rizumu Ayaka <rizumu@ayaka.moe> Date: Thu Mar 7 22:23:13 2024 +0800 chore: merge branch 'minor' into feat/onEffectCleanup-and-baseWatch commit 60a1b97 Author: Rizumu Ayaka <rizumu@ayaka.moe> Date: Tue Jan 9 20:45:31 2024 +0800 feat: middleware in baseWatch commit 2fdda65 Merge: 39f07cd 2701355 Author: Rizumu Ayaka <rizumu@ayaka.moe> Date: Mon Jan 8 17:40:54 2024 +0800 Merge branch 'main' into feat/onEffectCleanup-and-baseWatch commit 39f07cd Author: Rizumu Ayaka <rizumu@ayaka.moe> Date: Mon Jan 8 17:40:18 2024 +0800 fix: should export getCurrentEffect function commit 770c21d Author: Rizumu Ayaka <rizumu@ayaka.moe> Date: Sat Jan 6 00:07:41 2024 +0800 fix: sync code changes according to the review in PR vuejs/vue-vapor#82 commit a6eb043 Merge: 8dd0c1f 0275dd3 Author: Rizumu Ayaka <rizumu@ayaka.moe> Date: Fri Jan 5 23:43:02 2024 +0800 chore: merge branch 'main' into feat/onEffectCleanup-and-baseWatch commit 8dd0c1f Merge: 2213634 274f6f7 Author: Rizumu Ayaka <rizumu@ayaka.moe> Date: Sun Dec 31 20:30:29 2023 +0800 chore: merge remote-tracking branch 'origin/minor' into feat/onEffectCleanup-and-baseWatch commit 2213634 Author: Rizumu Ayaka <rizumu@ayaka.moe> Date: Sun Dec 31 19:21:12 2023 +0800 refactor: simplify unwatch implementation commit f44ef0b Author: Rizumu Ayaka <rizumu@ayaka.moe> Date: Sun Dec 31 18:45:04 2023 +0800 feat: implement getCurrentEffect commit a078ad1 Author: Rizumu Ayaka <rizumu@ayaka.moe> Date: Thu Dec 28 21:28:28 2023 +0800 chore: rename handleWarn to onWarn commit 90fd005 Author: Rizumu Ayaka <rizumu@ayaka.moe> Date: Thu Dec 28 21:05:03 2023 +0800 chore: organize exports commit e9555ce Author: Rizumu Ayaka <rizumu@ayaka.moe> Date: Thu Dec 28 20:36:56 2023 +0800 test: baseWatch commit d99e9a6 Author: Rizumu Ayaka <rizumu@ayaka.moe> Date: Thu Dec 28 20:04:42 2023 +0800 test: onEffectCleanup in runtime-core commit 56c87ec Author: Rizumu Ayaka <rizumu@ayaka.moe> Date: Thu Dec 28 19:44:43 2023 +0800 test: baseWatch with onEffectCleanup commit 7c5f05a Merge: a8dc8e6 75dbbb8 Author: Rizumu Ayaka <rizumu@ayaka.moe> Date: Thu Dec 28 17:32:00 2023 +0800 Merge branch 'minor' of https://github.com/vuejs/core into feat/onEffectCleanup-and-baseWatch commit a8dc8e6 Author: Rizumu Ayaka <rizumu@ayaka.moe> Date: Wed Dec 27 22:43:17 2023 +0800 fix: tracked in cleanup commit b57405c Author: Rizumu Ayaka <rizumu@ayaka.moe> Date: Wed Dec 27 20:28:49 2023 +0800 fix: treeshaking error commit 4d04f5e Author: Rizumu Ayaka <rizumu@ayaka.moe> Date: Wed Dec 27 20:19:53 2023 +0800 fix: treeshaking error commit d1f001b Author: Rizumu Ayaka <rizumu@ayaka.moe> Date: Wed Dec 27 20:10:05 2023 +0800 fix: lint commit 97179ed Merge: 2aef609 9183069 Author: Rizumu Ayaka <rizumu@ayaka.moe> Date: Tue Dec 26 23:24:47 2023 +0800 chore: merge branch 'minor' of https://github.com/vuejs/core into feat/onEffectCleanup-and-baseWatch commit 2aef609 Author: Rizumu Ayaka <rizumu@ayaka.moe> Date: Tue Dec 26 22:19:26 2023 +0800 fix: some cases for server-renderer commit db4463c Author: Rizumu Ayaka <rizumu@ayaka.moe> Date: Tue Dec 26 21:40:12 2023 +0800 fix: export onEffectCleanup commit 409b52a Author: Rizumu Ayaka <rizumu@ayaka.moe> Date: Tue Dec 26 21:31:27 2023 +0800 refactor: the watch API with baseWatch commit d8682e8 Author: Rizumu Ayaka <rizumu@ayaka.moe> Date: Mon Dec 25 22:09:38 2023 +0800 feat: initial code of baseWatch commit f1fe01e Author: Rizumu Ayaka <rizumu@ayaka.moe> Date: Mon Dec 25 20:50:35 2023 +0800 refactor: externalized COMPAT case
7fbdc6e
to
1730ab4
Compare
The third parameter of |
commit: @vue/compiler-core
@vue/compiler-dom
@vue/compiler-sfc
@vue/compiler-ssr
@vue/reactivity
@vue/runtime-core
@vue/runtime-dom
@vue/server-renderer
@vue/shared
vue
@vue/compat
|
Hi, Evan. Thank you for helping me improve the code |
baseWatch
and onWatcherCleanup
watch
, getCurrentWatcher
, and onWatcherCleanup
Notable changes applied:
|
/ecosystem-ci run |
📝 Ran ecosystem CI: Open
|
/ecosystem-ci run radix-vue |
📝 Ran ecosystem CI: Open
|
a8ea136
to
f0f2647
Compare
This PR achieves two objectives:
It refactors the
apiWatch
implementation, incorporating most of its functionality into thebaseWatch
in reactivity.It incorporates the
onWatcherCleanup
, previously used in vue/core-vapor repository, directly into the reactivity package of vue/core repository.baseWatch
The rationale behind refactoring
apiWatch
is that Vapor requires Watch APIs. However runtime-vapor should not import runtime-core directly. If we don't share reusable Watch API logic between runtime-core and runtime-vapor, it will result in significant code duplication. Furthermore, we plan to extract other codes that can be shared between these two runtimes into separate packages.onWatcherCleanup
The
onWatcherCleanup
function has already been implemented in Vapor. Here are corresponding Issue and PR links:Issue / PR
Additionally, provide support for
watch