question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

beforeUpdate hook in directives?

See original GitHub issue

We 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:

  1. vue renders dom
  2. lib initializes (dom modification) ==> state update ($set)
  3. lib uninitialize (revert dom modification)
  4. vue rerenders dom
  5. 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:closed
  • Created 9 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
dennisreimanncommented, Apr 30, 2016

Looks like this made it into 2.0 👏

0reactions
dennisreimanncommented, Aug 9, 2014

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 😃

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found