Browse Source

Fixes: Mobile - Potential memory leak with tippy.js.

Dusan Vuckovic 2 years ago
parent
commit
bbbe0aa599

+ 4 - 1
app/frontend/shared/components/Form/fields/FieldEditor/suggestions/suggestions.ts

@@ -100,7 +100,10 @@ export default function buildMentionExtension<T>(
         },
         onExit() {
           mounted = false
-          popup.destroy()
+
+          // Destroy tippy.js instance, but only if it has not been destroyed yet (i.e. it was left open).
+          if (!popup.state.isDestroyed) popup.destroy()
+
           component.destroy()
         },
       }