Skip to content

beforeUpdated directive hook is called as a reactive effect, which is unexpected #3697

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
0x009922 opened this issue Apr 30, 2021 · 0 comments · Fixed by #3699
Closed

beforeUpdated directive hook is called as a reactive effect, which is unexpected #3697

0x009922 opened this issue Apr 30, 2021 · 0 comments · Fixed by #3699
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. 🐞 bug Something isn't working

Comments

@0x009922
Copy link

Version

3.0.11

Reproduction link

https://codepen.io/liquid-solid/pen/LYxoKEN

Steps to reproduce

  • Open repro link
  • Open console
  • Click somewhere on bordered element
  • Watch console logs

What is expected?

It is expected that if a callback modifies some reactive data that does not affect rendering, it should be called once.

What is actually happening?

Actually, callback falls into recursive reactive effect loop. Also, in the local dev server (via vite) appears vue message "Error: Maximum recursive updates exceeded..."


Everything works fine with updated hook.
Context of my bug - i need to update reactive info about element scrollTop/scrollHeight/offsetHeight, which not directly affects render function, and i tried to update it in the beforeUpdated directive hook.

@0x009922 0x009922 changed the title beforeUpdate directive hook calls like reactive effect which make break logic beforeUpdated directive hook is called as a reactive effect, which is unexpected Apr 30, 2021
@HcySunYang HcySunYang added 🐞 bug Something isn't working 🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. labels Apr 30, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Oct 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. 🐞 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants