Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Remove layout logging noise from console
- 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 <[email protected]>
  • Loading branch information
christian-byrne and claude committed Aug 19, 2025
commit 5c4b8fc77e3672c1db78444464c96d908f65627c
12 changes: 0 additions & 12 deletions src/renderer/core/layout/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,6 @@ export const NODE_DEFAULTS = {
VISIBLE: true
} 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
*/
Expand Down
59 changes: 1 addition & 58 deletions src/renderer/core/layout/store/LayoutStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
* Uses Yjs for efficient local state management and future collaboration.
* 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 * as Y from 'yjs'

import { ACTOR_CONFIG, DEBUG_CONFIG } from '@/renderer/core/layout/constants'
import { ACTOR_CONFIG } from '@/renderer/core/layout/constants'
import type {
CreateNodeOperation,
DeleteNodeOperation,
Expand All @@ -27,13 +26,6 @@ import type {
} from '@/renderer/core/layout/types'
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 {
// Yjs document and shared data structures
private ydoc = new Y.Doc()
Expand Down Expand Up @@ -74,25 +66,10 @@ class LayoutStoreImpl implements LayoutStore {
event.changes.keys.forEach((_change, key) => {
const trigger = this.nodeTriggers.get(key)
if (trigger) {
logger.debug(`Yjs change detected for node ${key}, triggering ref`)
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)
})
}
}

/**
Expand All @@ -102,8 +79,6 @@ class LayoutStoreImpl implements LayoutStore {
let nodeRef = this.nodeRefs.get(nodeId)

if (!nodeRef) {
logger.debug(`Creating new layout ref for node ${nodeId}`)

nodeRef = customRef<NodeLayout | null>((track, trigger) => {
// Store the trigger so we can call it when Yjs changes
this.nodeTriggers.set(nodeId, trigger)
Expand All @@ -113,11 +88,6 @@ class LayoutStoreImpl implements LayoutStore {
track()
const ynode = this.ynodes.get(nodeId)
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
},
set: (newLayout: NodeLayout | null) => {
Expand Down Expand Up @@ -192,7 +162,6 @@ class LayoutStoreImpl implements LayoutStore {
}
}
}
logger.debug(`Layout ref SET triggering for node ${nodeId}`)
trigger()
}
}
Expand Down Expand Up @@ -294,12 +263,6 @@ class LayoutStoreImpl implements LayoutStore {
* Apply a layout operation using Yjs transactions
*/
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
const change: LayoutChange = {
type: 'update',
Expand Down Expand Up @@ -360,9 +323,6 @@ class LayoutStoreImpl implements LayoutStore {
change.nodeIds.forEach((nodeId) => {
const trigger = this.nodeTriggers.get(nodeId)
if (trigger) {
logger.debug(
`Manually triggering ref for node ${nodeId} after operation`
)
trigger()
}
})
Expand Down Expand Up @@ -413,11 +373,6 @@ class LayoutStoreImpl implements LayoutStore {
initializeFromLiteGraph(
nodes: Array<{ id: string; pos: [number, number]; size: [number, number] }>
): 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.ynodes.clear()
this.nodeRefs.clear()
Expand All @@ -443,17 +398,8 @@ class LayoutStoreImpl implements LayoutStore {

// Add to spatial index
this.spatialIndex.insert(layout.id, layout.bounds)

logger.debug(
`Initialized node ${layout.id} at position:`,
layout.position
)
})
}, 'initialization')

logger.debug('Layout store initialization complete', {
totalNodes: this.ynodes.size
})
}

// Operation handlers
Expand All @@ -463,12 +409,9 @@ class LayoutStoreImpl implements LayoutStore {
): void {
const ynode = this.ynodes.get(operation.nodeId)
if (!ynode) {
logger.warn(`No ynode found for ${operation.nodeId}`)
return
}

logger.debug(`Moving node ${operation.nodeId}`, operation.position)

const size = ynode.get('size') as { width: number; height: number }
ynode.set('position', operation.position)
this.updateNodeBounds(ynode, operation.position, size)
Expand Down
Loading