Skip to content

Commit 2c71735

Browse files
alecgibsonAlec Gibson
andauthored
fix: Add guards for popperInstance (#567)
This change attempts to fix some alerts that have been received where `popperInstance` is `undefined`, but we try to access methods on it. Co-authored-by: Alec Gibson <[email protected]>
1 parent 1bebd14 commit 2c71735

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/lib/tooltip.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ export default class Tooltip {
241241
_setContent (content, options) {
242242
this.asyncContent = false
243243
this._applyContent(content, options).then(() => {
244+
if (!this.popperInstance) return;
244245
this.popperInstance.update()
245246
})
246247
}
@@ -420,7 +421,9 @@ export default class Tooltip {
420421
this._tooltipNode.style.display = 'none'
421422
this._tooltipNode.setAttribute('aria-hidden', 'true')
422423

423-
this.popperInstance.disableEventListeners()
424+
if (this.popperInstance) {
425+
this.popperInstance.disableEventListeners()
426+
}
424427

425428
clearTimeout(this._disposeTimer)
426429
const disposeTime = directive.options.disposeTimeout

0 commit comments

Comments
 (0)