bugfix: physics persisted sometimes after slideshow ends. now explicitly stopping physics after slideshow ends

This commit is contained in:
Vidya Rupak 2025-12-22 17:24:49 -07:00
parent ccef366625
commit b86785d5c8

View file

@ -578,6 +578,8 @@ export const MemoryGraph = ({
if (!isSlideshowActive) {
// Close the popover when stopping slideshow
setSelectedNode(null)
// Explicitly cool down physics simulation in case timeout hasn't fired yet
forceSimulation.coolDown()
return
}
@ -622,6 +624,7 @@ export const MemoryGraph = ({
clearTimeout(physicsTimeoutRef.current)
}
physicsTimeoutRef.current = setTimeout(() => {
// Only cool down if slideshow is still active or if this is cleanup
forceSimulationRef.current.coolDown()
physicsTimeoutRef.current = null
}, 1000)