Remove console logs

This commit is contained in:
Christian Simon
2025-12-04 14:03:34 +00:00
parent 32175192fb
commit 07218f3417
8 changed files with 0 additions and 98 deletions
@@ -98,7 +98,6 @@ export function ExploreMapDrilldownPanel({
}
} catch (e) {
// If URL parsing fails, use the original URL
console.warn('Failed to parse URL for kiosk mode:', e);
}
// On initial mount, set the URL immediately (only once)
@@ -182,7 +181,6 @@ export function ExploreMapDrilldownPanel({
}
} catch (e) {
// If URL parsing fails, use the original URL
console.warn('Failed to parse URL for kiosk mode:', e);
}
lastSavedUrl = urlToSave;
@@ -204,8 +202,6 @@ export function ExploreMapDrilldownPanel({
lastLocalUrlRef.current = undefined;
}
}, 2000);
} else if (!currentUrl) {
console.log('No URL detected');
}
} catch (e) {
console.error('Cannot read iframe URL:', e);
@@ -219,16 +219,12 @@ export function ExploreMapCanvas() {
return;
}
console.log('Selection end:', selectionRect);
// Calculate selection rectangle bounds
const minX = Math.min(selectionRect.startX, selectionRect.currentX);
const maxX = Math.max(selectionRect.startX, selectionRect.currentX);
const minY = Math.min(selectionRect.startY, selectionRect.currentY);
const maxY = Math.max(selectionRect.startY, selectionRect.currentY);
console.log('Selection bounds:', { minX, maxX, minY, maxY });
// Find panels that intersect with selection rectangle
const selectedPanelIds = Object.values(panels).filter((panel) => {
const panelLeft = panel.position.x;
@@ -237,21 +233,16 @@ export function ExploreMapCanvas() {
const panelBottom = panel.position.y + panel.position.height;
const intersects = !(panelRight < minX || panelLeft > maxX || panelBottom < minY || panelTop > maxY);
console.log('Panel', panel.id, 'bounds:', { panelLeft, panelRight, panelTop, panelBottom }, 'intersects:', intersects);
return intersects;
}).map((panel) => panel.id);
console.log('Selected panel IDs:', selectedPanelIds);
// Check if Cmd/Ctrl is held for additive selection
const isAdditive = e.metaKey || e.ctrlKey;
if (selectedPanelIds.length > 0) {
// Select all panels at once
console.log('Dispatching selectMultiplePanels with:', { panelIds: selectedPanelIds, addToSelection: isAdditive });
dispatch(selectMultiplePanelsCRDT({ panelIds: selectedPanelIds, addToSelection: isAdditive }));
console.log('After dispatch');
justCompletedSelectionRef.current = true;
} else if (!isAdditive) {
// Clear selection if no panels selected and not holding modifier
@@ -175,29 +175,12 @@ function ExploreMapPanelContainerComponent({ panel }: ExploreMapPanelContainerPr
panel.position.height
);
// eslint-disable-next-line no-console
console.log('[Frame Association] Panel drag ended:', {
panelId: panel.id,
currentFrameId: panel.frameId,
intersectingFrameId,
panelPos: { x: data.x, y: data.y },
willAssociate: intersectingFrameId && intersectingFrameId !== panel.frameId,
willDisassociate: !intersectingFrameId && panel.frameId,
});
if (intersectingFrameId && intersectingFrameId !== panel.frameId) {
// Panel moved into a frame
const frame = frames[intersectingFrameId];
const offsetX = data.x - frame.position.x;
const offsetY = data.y - frame.position.y;
// eslint-disable-next-line no-console
console.log('[Frame Association] Associating panel with frame:', {
panelId: panel.id,
frameId: intersectingFrameId,
offset: { offsetX, offsetY },
});
dispatch(
associatePanelWithFrame({
panelId: panel.id,
@@ -208,12 +191,6 @@ function ExploreMapPanelContainerComponent({ panel }: ExploreMapPanelContainerPr
);
} else if (!intersectingFrameId && panel.frameId) {
// Panel moved out of frame
// eslint-disable-next-line no-console
console.log('[Frame Association] Disassociating panel from frame:', {
panelId: panel.id,
frameId: panel.frameId,
});
dispatch(
disassociatePanelFromFrame({
panelId: panel.id,
@@ -80,15 +80,11 @@ export function useCanvasPersistence(options: UseMapPersistenceOptions = {}) {
// Load from API
try {
setLoading(true);
// eslint-disable-next-line no-console
console.log('[Frame Persistence] Loading from API:', { uid });
const mapData = await exploreMapApi.getExploreMap(uid);
// Handle empty or missing data (new maps)
let parsed: ExploreMapState;
if (!mapData.data || mapData.data.trim() === '') {
// eslint-disable-next-line no-console
console.log('[Frame Persistence] Empty map data, initializing with defaults');
// Initialize with default empty state for new maps
parsed = {
...initialExploreMapState,
@@ -100,18 +96,6 @@ export function useCanvasPersistence(options: UseMapPersistenceOptions = {}) {
// Use title from DB column, not from JSON data
parsed.uid = mapData.uid;
parsed.title = mapData.title;
// eslint-disable-next-line no-console
console.log('[Frame Persistence] Loaded map data:', {
uid: parsed.uid,
title: parsed.title,
panelCount: Object.keys(parsed.panels || {}).length,
frameCount: Object.keys(parsed.frames || {}).length,
frameIds: Object.keys(parsed.frames || {}),
frames: parsed.frames,
hasCrdtState: !!parsed.crdtState,
crdtFrames: parsed.crdtState?.frames,
crdtFrameData: parsed.crdtState?.frameData,
});
}
// Load into legacy state (for backward compatibility)
@@ -120,13 +104,9 @@ export function useCanvasPersistence(options: UseMapPersistenceOptions = {}) {
// Initialize CRDT state from loaded data
// If CRDT state is available, use it directly. Otherwise, initialize from legacy panels.
if (parsed.crdtState) {
// eslint-disable-next-line no-console
console.log('[Frame Persistence] Loading CRDT state');
// Load the saved CRDT state which includes proper OR-Set metadata
dispatch(loadCRDTState({ crdtState: parsed.crdtState }));
} else {
// eslint-disable-next-line no-console
console.log('[Frame Persistence] No CRDT state found, initializing from legacy state');
// Fallback to legacy initialization for backward compatibility
dispatch(initializeFromLegacyState({
uid: parsed.uid,
@@ -196,28 +176,16 @@ export function useCanvasPersistence(options: UseMapPersistenceOptions = {}) {
const mapTitle = selectMapTitle(crdtState);
const viewport = selectViewport(crdtState);
// eslint-disable-next-line no-console
console.log('[Frame Persistence] Current state:', {
panelCount: Object.keys(panels || {}).length,
frameCount: Object.keys(frames || {}).length,
frameIds: Object.keys(frames || {}),
frames: frames,
});
// Don't persist an empty canvas; this avoids removing a previously saved
// non-empty canvas when the in-memory state is still at its initial value.
// Allow saving if there are either panels or frames
if (Object.keys(panels || {}).length === 0 && Object.keys(frames || {}).length === 0) {
// eslint-disable-next-line no-console
console.log('[Frame Persistence] Skipping save - empty canvas');
return;
}
// Check if CRDT state has actually changed (ignore local UI state like selection)
const currentCRDTStateStr = crdtState.crdtStateJSON;
if (currentCRDTStateStr === lastSavedCRDTStateRef.current) {
// eslint-disable-next-line no-console
console.log('[Frame Persistence] Skipping save - no CRDT state changes');
// No changes to persist
return;
}
@@ -246,17 +214,6 @@ export function useCanvasPersistence(options: UseMapPersistenceOptions = {}) {
crdtState: crdtState.crdtStateJSON ? JSON.parse(crdtState.crdtStateJSON) : undefined,
};
// eslint-disable-next-line no-console
console.log('[Frame Persistence] Preparing to save:', {
uid,
panelCount: Object.keys(panels || {}).length,
frameCount: Object.keys(frames || {}).length,
frameIds: Object.keys(frames || {}),
hasCrdtState: !!enrichedState.crdtState,
crdtFramesInState: enrichedState.crdtState?.frames,
crdtFrameDataInState: enrichedState.crdtState?.frameData,
});
if (uid) {
// Save to API with debounce
saveTimeoutRef.current = setTimeout(async () => {
@@ -62,12 +62,10 @@ export function useExploreStateReceiver(options: UseExploreStateReceiverOptions)
return;
}
console.log('[ExploreReceiver] Received new explore state for panel', panelId, exploreState);
lastAppliedStateRef.current = exploreStateStr;
// Apply queries if they've changed
if (exploreState.queries && JSON.stringify(exploreState.queries) !== JSON.stringify(explorePane.queries)) {
console.log('[ExploreReceiver] Applying queries', exploreState.queries);
dispatch(setQueriesAction({
exploreId,
queries: exploreState.queries,
@@ -76,7 +74,6 @@ export function useExploreStateReceiver(options: UseExploreStateReceiverOptions)
// Apply datasource if it's changed
if (exploreState.datasourceUid && exploreState.datasourceUid !== explorePane.datasourceInstance?.uid) {
console.log('[ExploreReceiver] Changing datasource to', exploreState.datasourceUid);
dispatch(changeDatasource({
exploreId,
datasource: exploreState.datasourceUid,
@@ -85,7 +82,6 @@ export function useExploreStateReceiver(options: UseExploreStateReceiverOptions)
// Apply time range if it's changed
if (exploreState.range && JSON.stringify(exploreState.range) !== JSON.stringify(explorePane.range)) {
console.log('[ExploreReceiver] Updating time range', exploreState.range);
// If range.raw exists, use it (for properly structured TimeRange objects)
// Otherwise, treat the range itself as a RawTimeRange (for backward compatibility)
const rawRange = (exploreState.range as any).raw || exploreState.range;
@@ -57,7 +57,6 @@ export function useExploreStateSync(options: UseExploreStateSyncOptions) {
return;
}
console.log('[ExploreSync] Explore state changed for panel', panelId, currentState);
previousStateRef.current = currentStateStr;
// Clear any pending sync
@@ -67,7 +66,6 @@ export function useExploreStateSync(options: UseExploreStateSyncOptions) {
// Debounce the sync operation
syncTimeoutRef.current = setTimeout(() => {
console.log('[ExploreSync] Dispatching savePanelExploreState for panel', panelId);
dispatch(savePanelExploreState({
panelId,
exploreState: currentState,
@@ -200,16 +200,12 @@ export function useRealtimeSync(options: RealtimeSyncOptions): RealtimeSyncStatu
const channelAddress = channelAddressRef.current;
console.log('[CRDT] Broadcasting', pendingOperations.length, 'pending operations');
// Broadcast each pending operation
for (const operation of pendingOperations) {
try {
// Mark as applied locally
appliedOpsRef.current.add(operation.operationId);
console.log('[CRDT] Broadcasting operation:', operation.type, operation.operationId);
// Publish to channel
liveService.publish(channelAddress, operation).catch((error) => {
console.error('[CRDT] Failed to broadcast operation:', error);
@@ -128,20 +128,11 @@ const crdtSlice = createSlice({
* Load CRDT state from server
*/
loadState: (state, action: PayloadAction<{ crdtState: CRDTExploreMapStateJSON }>) => {
// eslint-disable-next-line no-console
console.log('[Frame CRDT] Loading state from JSON:', {
hasFrames: !!action.payload.crdtState.frames,
hasFrameData: !!action.payload.crdtState.frameData,
frames: action.payload.crdtState.frames,
frameData: action.payload.crdtState.frameData,
});
const manager = CRDTStateManager.fromJSON(action.payload.crdtState, state.nodeId);
saveCRDTManager(state, manager);
// Restore uid from the loaded CRDT state
const crdtState = manager.getState();
state.uid = crdtState.uid;
// eslint-disable-next-line no-console
console.log('[Frame CRDT] State loaded, frame IDs:', manager.getFrameIds());
},
/**