Skip to content

feat(runtime): beforeUpdate & update hook #87

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

Closed
wants to merge 6 commits into from

Conversation

GaoNeng-wWw
Copy link
Contributor

@GaoNeng-wWw GaoNeng-wWw commented Jan 3, 2024

Implemented beforeUpdate and Update hooks

demo vvv

2

Copy link

github-actions bot commented Jan 3, 2024

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 90.2 kB 34.3 kB 30.9 kB
runtime-vapor.global.prod.js 23.7 kB (+443 B) 9.05 kB (+189 B) 8.34 kB (+153 B)
vue-vapor.global.prod.js 58.7 kB (+443 B) 20.1 kB (+187 B) 18.2 kB (+132 B)
vue.global.prod.js 147 kB 53.5 kB 47.8 kB

Usages

Name Size Gzip Brotli
createApp 50.7 kB 19.8 kB 18 kB
createSSRApp 54 kB 21.1 kB 19.2 kB
defineCustomElement 52.9 kB 20.5 kB 18.7 kB
vapor 23.6 kB (+437 B) 9.07 kB (+186 B) 8.34 kB (+157 B)
overall 64.1 kB 24.7 kB 22.5 kB

@GaoNeng-wWw GaoNeng-wWw changed the title feat(runtime): beforeUpdate & update hook WIP feat(runtime): beforeUpdate & update hook Jan 4, 2024
@GaoNeng-wWw GaoNeng-wWw mentioned this pull request Jan 5, 2024
12 tasks
@GaoNeng-wWw GaoNeng-wWw changed the title WIP feat(runtime): beforeUpdate & update hook feat(runtime): beforeUpdate & update hook Jan 5, 2024
Copy link
Member

@LittleSound LittleSound left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution.

I've incorporated a console.log within the watchEffect for testing purposes, as shown in the attached image.

image

However, using MutationObserver doesn't appear to be an effective approach. It only functions post-update and fails to execute pre-update operations.

In reality, I'm progressing with the development of these Hooks features through a different strategy that I have conceptualized. You can refer to issues #86 and #82 for more details. Once prepared, I will initiate a PR.

@GaoNeng-wWw
Copy link
Contributor Author

Thank you for your contribution.

I've incorporated a console.log within the watchEffect for testing purposes, as shown in the attached image.

image

However, using MutationObserver doesn't appear to be an effective approach. It only functions post-update and fails to execute pre-update operations.

In reality, I'm progressing with the development of these Hooks features through a different strategy that I have conceptualized. You can refer to issues #86 and #82 for more details. Once prepared, I will initiate a PR.

I saw a comment for TODO in renderWatch.ts, and I thought maybe you wanted to implement the update hook in the renderWatch.ts file, so I chose to close this PR. And, like you, I believe that MutationObserver is not a good implementation solution

@GaoNeng-wWw GaoNeng-wWw closed this Jan 7, 2024
@GaoNeng-wWw GaoNeng-wWw deleted the feat/onUpdateHook branch January 7, 2024 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants