Skip to content

Commit 1e271bc

Browse files
committed
Always delay the destruction of bootstrap objects during cleanup
A JavaScript error occurred when clicking the "Edit" menu at the top right of saved search widgets: Uncaught TypeError: Cannot convert undefined or null to object at Object.values (<anonymous>) at Ni._isWithActiveTrigger (bootstrap.min.js:6:48663) This was caused by the "dispose" method being called too early, conflicting with other active code that still required the instance. The issue can be resolved by delaying the "dispose" method call. Previously, we had already delayed it, but only during transitions or when it was shown, which unfortunately wasn't sufficient.
1 parent 3207dc7 commit 1e271bc

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

share/static/js/util.js

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,22 +1018,17 @@ jQuery(function() {
10181018
if (elt.matches(item.selector)) {
10191019
const instance = bootstrap[item.component].getInstance(elt);
10201020
if (instance) {
1021-
if (instance._isTransitioning || ( instance._isShown && instance._isShown() ) ) {
1022-
if ( instance._isShown && instance._isShown() ) {
1023-
instance.hide();
1024-
}
1025-
1026-
let interval;
1027-
interval = setInterval(function () {
1028-
if (!instance._isTransitioning) {
1029-
instance.dispose();
1030-
clearInterval(interval);
1031-
}
1032-
}, 200);
1033-
}
1034-
else {
1035-
instance.dispose();
1021+
if (instance._isShown && instance._isShown()) {
1022+
instance.hide();
10361023
}
1024+
1025+
let interval;
1026+
interval = setInterval(function () {
1027+
if (!instance._isTransitioning) {
1028+
instance.dispose();
1029+
clearInterval(interval);
1030+
}
1031+
}, 200);
10371032
}
10381033
return;
10391034
}

0 commit comments

Comments
 (0)