Skip to content

Commit

Permalink
fix: first render and update of referenceElement
Browse files Browse the repository at this point in the history
  • Loading branch information
FezVrasta committed Apr 19, 2020
1 parent 938b1df commit 47cd992
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Popper.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script>
import { onDestroy } from "svelte";
import { onDestroy, tick } from "svelte";
import { writable } from "svelte/store";
import { createPopper } from "@popperjs/core";
Expand All @@ -23,11 +23,12 @@
fn: ({ state }) => store.set(state)
};
$: {
$: (async () => {
if (
previousPopperElement != popperElement ||
previousReferenceElement != previousReferenceElement
previousReferenceElement != referenceElement
) {
await tick();
popperInstance && popperInstance.destroy();
if (referenceElement != null && popperElement != null) {
Expand All @@ -43,7 +44,7 @@
previousReferenceElement = referenceElement;
}
}
}
})();
$: {
if (popperInstance != null) {
Expand Down

0 comments on commit 47cd992

Please sign in to comment.