beforeUpdate hook in directives?
See original GitHub issueWe are trying to find a solution for being notified before a dom update takes place.
In our particular usecase we are integrating vue with a third party plugin that also manipulated the DOM. We are looking for a safe way to ensure this execution order:
- vue renders dom
- lib initializes (dom modification) ==> state update ($set)
- lib uninitialize (revert dom modification)
- vue rerenders dom
- lib initializes (dom modification)
We’ve tried to use a directive for this but this only solves step 2 and 5 (Directive.update
). We are looking for something like beforeUpdate
inside the directive to handle 3.
Is there a proper way to handle this?
Issue Analytics
- State:
- Created 9 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Lifecycle hooks - Angular
Directives have a similar lifecycle, as Angular creates, updates, and destroys instances in the course of execution. Your application can use lifecycle hook...
Read more >Options: Lifecycle | Vue.js
This hook is not called during server-side rendering. beforeUpdate #. Called right before the component is about to update its DOM tree due...
Read more >New Hook Functions in directives in Vue 3 - CodimTh
beforeUpdate: new! This is called before the element itself is updated, much like the component lifecycle hooks. update → removed! There were ...
Read more >Lifecycle / beforeUpdate and afterUpdate • Svelte Tutorial
The beforeUpdate function schedules work to happen immediately before the DOM is updated. afterUpdate is its counterpart, used for running code once the...
Read more >Vue Lifecycle Hooks | Front-End Development Projects with ...
beforeUpdate : Runs immediately after a change to your component occurs, and before it has been re-rendered. Useful for acquiring the state of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Looks like this made it into 2.0 👏
Alright, so we’ll leave it at that and I’ll close it for now. I’ll let you know if we find a nice way to encapsulate this nicely 😃