Remove layout logging noise from console (#5101)

- Remove loglevel import and logger setup from LayoutStore
- Remove all logger.debug() calls throughout LayoutStore
- Remove localStorage debug check for layout operations
- Remove unused DEBUG_CONFIG from layout constants
- Clean up console noise while preserving error handling

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Christian Byrne
2025-08-19 10:05:29 -07:00
committed by GitHub
parent 23ceb04994
commit 55c4e3418a
2 changed files with 1 additions and 70 deletions

View File

@@ -48,18 +48,6 @@ export const NODE_DEFAULTS = {
VISIBLE: true VISIBLE: true
} as const } as const
/**
* Debug and development settings
*/
export const DEBUG_CONFIG = {
/** LocalStorage key for enabling layout debug mode */
LAYOUT_DEBUG_KEY: 'layout-debug',
/** Logger name for layout system */
LOGGER_NAME: 'layout',
/** Logger name for layout store */
STORE_LOGGER_NAME: 'layout-store'
} as const
/** /**
* Actor and source identifiers * Actor and source identifiers
*/ */

View File

@@ -4,11 +4,10 @@
* Uses Yjs for efficient local state management and future collaboration. * Uses Yjs for efficient local state management and future collaboration.
* CRDT ensures conflict-free operations for both single and multi-user scenarios. * CRDT ensures conflict-free operations for both single and multi-user scenarios.
*/ */
import log from 'loglevel'
import { type ComputedRef, type Ref, computed, customRef } from 'vue' import { type ComputedRef, type Ref, computed, customRef } from 'vue'
import * as Y from 'yjs' import * as Y from 'yjs'
import { ACTOR_CONFIG, DEBUG_CONFIG } from '@/renderer/core/layout/constants' import { ACTOR_CONFIG } from '@/renderer/core/layout/constants'
import type { import type {
CreateNodeOperation, CreateNodeOperation,
DeleteNodeOperation, DeleteNodeOperation,
@@ -27,13 +26,6 @@ import type {
} from '@/renderer/core/layout/types' } from '@/renderer/core/layout/types'
import { SpatialIndexManager } from '@/renderer/core/spatial/SpatialIndex' import { SpatialIndexManager } from '@/renderer/core/spatial/SpatialIndex'
// Create logger for layout store
const logger = log.getLogger(DEBUG_CONFIG.STORE_LOGGER_NAME)
// In dev mode, always show debug logs
if (import.meta.env.DEV) {
logger.setLevel('debug')
}
class LayoutStoreImpl implements LayoutStore { class LayoutStoreImpl implements LayoutStore {
// Yjs document and shared data structures // Yjs document and shared data structures
private ydoc = new Y.Doc() private ydoc = new Y.Doc()
@@ -74,25 +66,10 @@ class LayoutStoreImpl implements LayoutStore {
event.changes.keys.forEach((_change, key) => { event.changes.keys.forEach((_change, key) => {
const trigger = this.nodeTriggers.get(key) const trigger = this.nodeTriggers.get(key)
if (trigger) { if (trigger) {
logger.debug(`Yjs change detected for node ${key}, triggering ref`)
trigger() trigger()
} }
}) })
}) })
// Debug: Log layout operations
if (localStorage.getItem(DEBUG_CONFIG.LAYOUT_DEBUG_KEY) === 'true') {
this.yoperations.observe((event) => {
const operations: LayoutOperation[] = []
event.changes.added.forEach((item) => {
const content = item.content.getContent()
if (Array.isArray(content) && content.length > 0) {
operations.push(content[0] as LayoutOperation)
}
})
console.log('Layout Operation:', operations)
})
}
} }
/** /**
@@ -102,8 +79,6 @@ class LayoutStoreImpl implements LayoutStore {
let nodeRef = this.nodeRefs.get(nodeId) let nodeRef = this.nodeRefs.get(nodeId)
if (!nodeRef) { if (!nodeRef) {
logger.debug(`Creating new layout ref for node ${nodeId}`)
nodeRef = customRef<NodeLayout | null>((track, trigger) => { nodeRef = customRef<NodeLayout | null>((track, trigger) => {
// Store the trigger so we can call it when Yjs changes // Store the trigger so we can call it when Yjs changes
this.nodeTriggers.set(nodeId, trigger) this.nodeTriggers.set(nodeId, trigger)
@@ -113,11 +88,6 @@ class LayoutStoreImpl implements LayoutStore {
track() track()
const ynode = this.ynodes.get(nodeId) const ynode = this.ynodes.get(nodeId)
const layout = ynode ? this.yNodeToLayout(ynode) : null const layout = ynode ? this.yNodeToLayout(ynode) : null
logger.debug(`Layout ref GET for node ${nodeId}:`, {
position: layout?.position,
hasYnode: !!ynode,
version: this.version
})
return layout return layout
}, },
set: (newLayout: NodeLayout | null) => { set: (newLayout: NodeLayout | null) => {
@@ -192,7 +162,6 @@ class LayoutStoreImpl implements LayoutStore {
} }
} }
} }
logger.debug(`Layout ref SET triggering for node ${nodeId}`)
trigger() trigger()
} }
} }
@@ -294,12 +263,6 @@ class LayoutStoreImpl implements LayoutStore {
* Apply a layout operation using Yjs transactions * Apply a layout operation using Yjs transactions
*/ */
applyOperation(operation: LayoutOperation): void { applyOperation(operation: LayoutOperation): void {
logger.debug(`applyOperation called:`, {
type: operation.type,
nodeId: operation.nodeId,
operation
})
// Create change object outside transaction so we can use it after // Create change object outside transaction so we can use it after
const change: LayoutChange = { const change: LayoutChange = {
type: 'update', type: 'update',
@@ -360,9 +323,6 @@ class LayoutStoreImpl implements LayoutStore {
change.nodeIds.forEach((nodeId) => { change.nodeIds.forEach((nodeId) => {
const trigger = this.nodeTriggers.get(nodeId) const trigger = this.nodeTriggers.get(nodeId)
if (trigger) { if (trigger) {
logger.debug(
`Manually triggering ref for node ${nodeId} after operation`
)
trigger() trigger()
} }
}) })
@@ -413,11 +373,6 @@ class LayoutStoreImpl implements LayoutStore {
initializeFromLiteGraph( initializeFromLiteGraph(
nodes: Array<{ id: string; pos: [number, number]; size: [number, number] }> nodes: Array<{ id: string; pos: [number, number]; size: [number, number] }>
): void { ): void {
logger.debug('Initializing layout store from LiteGraph', {
nodeCount: nodes.length,
nodes: nodes.map((n) => ({ id: n.id, pos: n.pos }))
})
this.ydoc.transact(() => { this.ydoc.transact(() => {
this.ynodes.clear() this.ynodes.clear()
this.nodeRefs.clear() this.nodeRefs.clear()
@@ -443,17 +398,8 @@ class LayoutStoreImpl implements LayoutStore {
// Add to spatial index // Add to spatial index
this.spatialIndex.insert(layout.id, layout.bounds) this.spatialIndex.insert(layout.id, layout.bounds)
logger.debug(
`Initialized node ${layout.id} at position:`,
layout.position
)
}) })
}, 'initialization') }, 'initialization')
logger.debug('Layout store initialization complete', {
totalNodes: this.ynodes.size
})
} }
// Operation handlers // Operation handlers
@@ -463,12 +409,9 @@ class LayoutStoreImpl implements LayoutStore {
): void { ): void {
const ynode = this.ynodes.get(operation.nodeId) const ynode = this.ynodes.get(operation.nodeId)
if (!ynode) { if (!ynode) {
logger.warn(`No ynode found for ${operation.nodeId}`)
return return
} }
logger.debug(`Moving node ${operation.nodeId}`, operation.position)
const size = ynode.get('size') as { width: number; height: number } const size = ynode.get('size') as { width: number; height: number }
ynode.set('position', operation.position) ynode.set('position', operation.position)
this.updateNodeBounds(ynode, operation.position, size) this.updateNodeBounds(ynode, operation.position, size)