Assorted fixes for issues that happen when routing instead of reloading

This commit is contained in:
Alexander Brown
2026-01-25 01:05:20 -08:00
parent 8afb45db9c
commit 33c457aca0
7 changed files with 25 additions and 21 deletions

View File

@@ -139,21 +139,11 @@ describe('useMinimapGraph', () => {
expect(mockGraph.onConnectionChange).toBe(originalOnConnectionChange)
})
it('should handle cleanup for never-setup graph', () => {
const consoleErrorSpy = vi
.spyOn(console, 'error')
.mockImplementation(() => {})
it('should handle cleanup for never-setup graph silently', () => {
const graphRef = ref(mockGraph as any)
const graphManager = useMinimapGraph(graphRef, onGraphChangedMock)
graphManager.cleanupEventListeners()
expect(consoleErrorSpy).toHaveBeenCalledWith(
'Attempted to cleanup event listeners for graph that was never set up'
)
consoleErrorSpy.mockRestore()
expect(() => graphManager.cleanupEventListeners()).not.toThrow()
})
it('should detect node position changes', () => {

View File

@@ -102,9 +102,7 @@ export function useMinimapGraph(
const originalCallbacks = originalCallbacksMap.get(g.id)
if (!originalCallbacks) {
console.error(
'Attempted to cleanup event listeners for graph that was never set up'
)
// Graph was never set up (e.g., minimap destroyed before init) - nothing to clean up
return
}