Skip to content

Commit 5c4b8fc

Browse files
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]>
1 parent 23ceb04 commit 5c4b8fc

File tree

2 files changed

+1
-70
lines changed

2 files changed

+1
-70
lines changed

src/renderer/core/layout/constants.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,6 @@ export const NODE_DEFAULTS = {
4848
VISIBLE: true
4949
} as const
5050

51-
/**
52-
* Debug and development settings
53-
*/
54-
export const DEBUG_CONFIG = {
55-
/** LocalStorage key for enabling layout debug mode */
56-
LAYOUT_DEBUG_KEY: 'layout-debug',
57-
/** Logger name for layout system */
58-
LOGGER_NAME: 'layout',
59-
/** Logger name for layout store */
60-
STORE_LOGGER_NAME: 'layout-store'
61-
} as const
62-
6351
/**
6452
* Actor and source identifiers
6553
*/

src/renderer/core/layout/store/LayoutStore.ts

Lines changed: 1 addition & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@
44
* Uses Yjs for efficient local state management and future collaboration.
55
* CRDT ensures conflict-free operations for both single and multi-user scenarios.
66
*/
7-
import log from 'loglevel'
87
import { type ComputedRef, type Ref, computed, customRef } from 'vue'
98
import * as Y from 'yjs'
109

11-
import { ACTOR_CONFIG, DEBUG_CONFIG } from '@/renderer/core/layout/constants'
10+
import { ACTOR_CONFIG } from '@/renderer/core/layout/constants'
1211
import type {
1312
CreateNodeOperation,
1413
DeleteNodeOperation,
@@ -27,13 +26,6 @@ import type {
2726
} from '@/renderer/core/layout/types'
2827
import { SpatialIndexManager } from '@/renderer/core/spatial/SpatialIndex'
2928

30-
// Create logger for layout store
31-
const logger = log.getLogger(DEBUG_CONFIG.STORE_LOGGER_NAME)
32-
// In dev mode, always show debug logs
33-
if (import.meta.env.DEV) {
34-
logger.setLevel('debug')
35-
}
36-
3729
class LayoutStoreImpl implements LayoutStore {
3830
// Yjs document and shared data structures
3931
private ydoc = new Y.Doc()
@@ -74,25 +66,10 @@ class LayoutStoreImpl implements LayoutStore {
7466
event.changes.keys.forEach((_change, key) => {
7567
const trigger = this.nodeTriggers.get(key)
7668
if (trigger) {
77-
logger.debug(`Yjs change detected for node ${key}, triggering ref`)
7869
trigger()
7970
}
8071
})
8172
})
82-
83-
// Debug: Log layout operations
84-
if (localStorage.getItem(DEBUG_CONFIG.LAYOUT_DEBUG_KEY) === 'true') {
85-
this.yoperations.observe((event) => {
86-
const operations: LayoutOperation[] = []
87-
event.changes.added.forEach((item) => {
88-
const content = item.content.getContent()
89-
if (Array.isArray(content) && content.length > 0) {
90-
operations.push(content[0] as LayoutOperation)
91-
}
92-
})
93-
console.log('Layout Operation:', operations)
94-
})
95-
}
9673
}
9774

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

10481
if (!nodeRef) {
105-
logger.debug(`Creating new layout ref for node ${nodeId}`)
106-
10782
nodeRef = customRef<NodeLayout | null>((track, trigger) => {
10883
// Store the trigger so we can call it when Yjs changes
10984
this.nodeTriggers.set(nodeId, trigger)
@@ -113,11 +88,6 @@ class LayoutStoreImpl implements LayoutStore {
11388
track()
11489
const ynode = this.ynodes.get(nodeId)
11590
const layout = ynode ? this.yNodeToLayout(ynode) : null
116-
logger.debug(`Layout ref GET for node ${nodeId}:`, {
117-
position: layout?.position,
118-
hasYnode: !!ynode,
119-
version: this.version
120-
})
12191
return layout
12292
},
12393
set: (newLayout: NodeLayout | null) => {
@@ -192,7 +162,6 @@ class LayoutStoreImpl implements LayoutStore {
192162
}
193163
}
194164
}
195-
logger.debug(`Layout ref SET triggering for node ${nodeId}`)
196165
trigger()
197166
}
198167
}
@@ -294,12 +263,6 @@ class LayoutStoreImpl implements LayoutStore {
294263
* Apply a layout operation using Yjs transactions
295264
*/
296265
applyOperation(operation: LayoutOperation): void {
297-
logger.debug(`applyOperation called:`, {
298-
type: operation.type,
299-
nodeId: operation.nodeId,
300-
operation
301-
})
302-
303266
// Create change object outside transaction so we can use it after
304267
const change: LayoutChange = {
305268
type: 'update',
@@ -360,9 +323,6 @@ class LayoutStoreImpl implements LayoutStore {
360323
change.nodeIds.forEach((nodeId) => {
361324
const trigger = this.nodeTriggers.get(nodeId)
362325
if (trigger) {
363-
logger.debug(
364-
`Manually triggering ref for node ${nodeId} after operation`
365-
)
366326
trigger()
367327
}
368328
})
@@ -413,11 +373,6 @@ class LayoutStoreImpl implements LayoutStore {
413373
initializeFromLiteGraph(
414374
nodes: Array<{ id: string; pos: [number, number]; size: [number, number] }>
415375
): void {
416-
logger.debug('Initializing layout store from LiteGraph', {
417-
nodeCount: nodes.length,
418-
nodes: nodes.map((n) => ({ id: n.id, pos: n.pos }))
419-
})
420-
421376
this.ydoc.transact(() => {
422377
this.ynodes.clear()
423378
this.nodeRefs.clear()
@@ -443,17 +398,8 @@ class LayoutStoreImpl implements LayoutStore {
443398

444399
// Add to spatial index
445400
this.spatialIndex.insert(layout.id, layout.bounds)
446-
447-
logger.debug(
448-
`Initialized node ${layout.id} at position:`,
449-
layout.position
450-
)
451401
})
452402
}, 'initialization')
453-
454-
logger.debug('Layout store initialization complete', {
455-
totalNodes: this.ynodes.size
456-
})
457403
}
458404

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

470-
logger.debug(`Moving node ${operation.nodeId}`, operation.position)
471-
472415
const size = ynode.get('size') as { width: number; height: number }
473416
ynode.set('position', operation.position)
474417
this.updateNodeBounds(ynode, operation.position, size)

0 commit comments

Comments
 (0)