Skip to content

Commit 5a35562

Browse files
[refactor] Migrate minimap to domain-driven renderer architecture (#5069)
* move ref initialization to the component * remove redundant init * [refactor] Move minimap to domain-driven renderer structure - Create new src/renderer/extensions/minimap/ structure following domain-driven design - Add composables: useMinimapGraph, useMinimapViewport, useMinimapRenderer, useMinimapInteraction, useMinimapSettings - Add minimapCanvasRenderer with efficient batched rendering - Add comprehensive type definitions in types.ts - Remove old src/composables/useMinimap.ts composable - Implement proper separation of concerns with dedicated composables for each domain The new structure provides cleaner APIs, better performance through batched rendering, and improved maintainability through domain separation. * [test] Fix minimap tests for new renderer structure - Update all test imports to use new renderer paths - Fix mock implementations to match new composable APIs - Add proper RAF mocking for throttled functions - Fix type assertions to handle strict TypeScript checks - Update test expectations for new implementation behavior - Fix viewport transform calculations in tests - Handle async/throttled behavior correctly in tests All 28 minimap tests now passing with new architecture. * [fix] Remove unused init import in MiniMap component * [refactor] Move useWorkflowThumbnail to renderer/thumbnail structure - Moved useWorkflowThumbnail from src/composables to src/renderer/thumbnail/composables - Updated all imports in components, stores and services - Moved test file to match new structure - This ensures all rendering-related composables live in the renderer directory * [test] Fix minimap canvas renderer test for connections - Fixed mock setup for graph links to match LiteGraph's hybrid Map/Object structure - LiteGraph expects links to be accessible both as a Map and as an object - Test now properly verifies connection rendering functionality
1 parent ceac8f3 commit 5a35562

25 files changed

+3025
-913
lines changed

src/components/graph/MiniMap.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
import Button from 'primevue/button'
5858
import { onMounted, onUnmounted, ref } from 'vue'
5959
60-
import { useMinimap } from '@/composables/useMinimap'
60+
import { useMinimap } from '@/renderer/extensions/minimap/composables/useMinimap'
6161
6262
import MiniMapPanel from './MiniMapPanel.vue'
6363
@@ -94,7 +94,9 @@ const toggleOptionsPanel = () => {
9494
}
9595
9696
onMounted(() => {
97-
setMinimapRef(minimapRef.value)
97+
if (minimapRef.value) {
98+
setMinimapRef(minimapRef.value)
99+
}
98100
})
99101
100102
onUnmounted(() => {

src/components/graph/MiniMapPanel.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
<script setup lang="ts">
8181
import Checkbox from 'primevue/checkbox'
8282
83-
import { MinimapOptionKey } from '@/composables/useMinimap'
83+
import type { MinimapSettingsKey } from '@/renderer/extensions/minimap/types'
8484
8585
defineProps<{
8686
panelStyles: any
@@ -92,6 +92,6 @@ defineProps<{
9292
}>()
9393
9494
defineEmits<{
95-
updateOption: [key: MinimapOptionKey, value: boolean]
95+
updateOption: [key: MinimapSettingsKey, value: boolean]
9696
}>()
9797
</script>

src/components/topbar/WorkflowTab.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import {
4040
usePragmaticDraggable,
4141
usePragmaticDroppable
4242
} from '@/composables/usePragmaticDragAndDrop'
43-
import { useWorkflowThumbnail } from '@/composables/useWorkflowThumbnail'
43+
import { useWorkflowThumbnail } from '@/renderer/thumbnail/composables/useWorkflowThumbnail'
4444
import { useWorkflowService } from '@/services/workflowService'
4545
import { useSettingStore } from '@/stores/settingStore'
4646
import { ComfyWorkflow } from '@/stores/workflowStore'

0 commit comments

Comments
 (0)