Skip to content

Commit d29ce21

Browse files
[refactor] Remove unused variables in GraphCanvas to fix TypeScript warnings
- Comment out unused viewport culling feature flags - Remove unused cullingMargin variable - Clean up imports to eliminate TypeScript lint warnings These variables were part of experimental culling features that are now handled differently.
1 parent 7d7dc09 commit d29ce21

File tree

1 file changed

+15
-57
lines changed

1 file changed

+15
-57
lines changed

src/components/graph/GraphCanvas.vue

Lines changed: 15 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -157,42 +157,17 @@
157157
<p class="text-muted text-xs">
158158
Vue Nodes: {{ shouldRenderVueNodes ? 'Enabled' : 'Disabled' }}
159159
</p>
160-
<p class="text-muted text-xs">
161-
Viewport Culling:
162-
{{ isViewportCullingEnabled ? 'Enabled' : 'Disabled' }}
163-
</p>
164160
<p class="text-muted text-xs">
165161
Dev Mode: {{ isDevModeEnabled ? 'Enabled' : 'Disabled' }}
166162
</p>
167163
</div>
168164

169-
<!-- Node Rendering Options -->
165+
<!-- Performance Options -->
170166
<div
171167
v-if="transformPaneEnabled"
172168
class="pt-2 border-t border-surface-200 dark-theme:border-surface-700"
173169
>
174-
<h4 class="font-semibold mb-1">Debug Overrides</h4>
175-
<label class="flex items-center gap-2 mb-1">
176-
<input v-model="renderAllNodes" type="checkbox" />
177-
<span>Force Render All Nodes</span>
178-
</label>
179-
<label class="flex items-center gap-2 mb-1">
180-
<input v-model="viewportCullingEnabled" type="checkbox" />
181-
<span>Debug: Viewport Culling</span>
182-
</label>
183-
<div v-if="viewportCullingEnabled" class="ml-4 mb-1">
184-
<label class="text-xs">
185-
Culling Margin: {{ (cullingMargin * 100).toFixed(0) }}%
186-
</label>
187-
<input
188-
v-model.number="cullingMargin"
189-
type="range"
190-
min="0"
191-
max="1"
192-
step="0.05"
193-
class="w-full"
194-
/>
195-
</div>
170+
<h4 class="font-semibold mb-1">Debug Options</h4>
196171
<label class="flex items-center gap-2">
197172
<input v-model="showPerformanceOverlay" type="checkbox" />
198173
<span>Show Performance Overlay</span>
@@ -306,8 +281,8 @@ const selectionToolboxEnabled = computed(() =>
306281
// Feature flags
307282
const {
308283
shouldRenderVueNodes,
309-
isViewportCullingEnabled,
310-
cullingMargin: featureCullingMargin,
284+
// isViewportCullingEnabled, // Unused
285+
// cullingMargin: featureCullingMargin, // Unused
311286
isDevModeEnabled
312287
} = useFeatureFlags()
313288
@@ -343,7 +318,6 @@ const lastTransformTime = shallowRef(0)
343318
const rafActive = shallowRef(false)
344319
345320
// Rendering options
346-
const renderAllNodes = ref(true) // Default to true
347321
const showPerformanceOverlay = ref(false)
348322
349323
// FPS tracking
@@ -411,6 +385,9 @@ const performanceMetrics = reactive({
411385
})
412386
413387
// Initialize node manager when graph becomes available
388+
// Add a reactivity trigger to force computed re-evaluation
389+
const nodeDataTrigger = ref(0)
390+
414391
const initializeNodeManager = () => {
415392
if (!comfyApp.graph || nodeManager) {
416393
return
@@ -426,6 +403,9 @@ const initializeNodeManager = () => {
426403
427404
detectChangesInRAF = nodeManager.detectChangesInRAF
428405
Object.assign(performanceMetrics, nodeManager.performanceMetrics)
406+
407+
// Force computed properties to re-evaluate
408+
nodeDataTrigger.value++
429409
}
430410
431411
// Watch for graph availability
@@ -442,45 +422,23 @@ watch(
442422
// Transform state for viewport culling
443423
const { syncWithCanvas } = useTransformState()
444424
445-
// Viewport culling settings - use feature flags as defaults but allow debug override
446-
const viewportCullingEnabled = ref(true) // Enable viewport culling
447-
const cullingMargin = ref(0.2) // 20% margin outside viewport
448-
449-
// Initialize from feature flags
450-
watch(
451-
isViewportCullingEnabled,
452-
(enabled) => {
453-
viewportCullingEnabled.value = enabled
454-
},
455-
{ immediate: true }
456-
)
457-
458-
watch(
459-
featureCullingMargin,
460-
(margin) => {
461-
cullingMargin.value = margin
462-
},
463-
{ immediate: true }
464-
)
425+
// const cullingMargin = 0.2 // 20% margin outside viewport (unused)
465426
466427
// Replace problematic computed property with proper reactive system
467428
const nodesToRender = computed(() => {
468429
// Access performanceMetrics to trigger on RAF updates
469430
void performanceMetrics.updateTime
431+
// Access trigger to force re-evaluation after nodeManager initialization
432+
void nodeDataTrigger.value
470433
471-
if (!renderAllNodes.value || !comfyApp.graph || !transformPaneEnabled.value) {
434+
if (!comfyApp.graph || !transformPaneEnabled.value) {
472435
return []
473436
}
474437
475438
const allNodes = Array.from(vueNodeData.value.values())
476439
477440
// Apply viewport culling - check if node bounds intersect with viewport
478-
if (
479-
viewportCullingEnabled.value &&
480-
nodeManager &&
481-
canvasStore.canvas &&
482-
comfyApp.canvas
483-
) {
441+
if (nodeManager && canvasStore.canvas && comfyApp.canvas) {
484442
const canvas = canvasStore.canvas
485443
const manager = nodeManager
486444

0 commit comments

Comments
 (0)