diff --git a/src/js/core/scrollspy.js b/src/js/core/scrollspy.js
index <HASH>..<HASH> 100644
--- a/src/js/core/scrollspy.js
+++ b/src/js/core/scrollspy.js
@@ -128,6 +128,10 @@ export default {
         toggle(el, inview) {
             const state = this._data.elements.get(el);
 
+            if (!state) {
+                return;
+            }
+
             state.off?.();
 
             css(el, 'visibility', !inview && this.hidden ? 'hidden' : '');
fix: case where component resets while toggle is enqueued