chore: remove some old console.logs

This commit is contained in:
2026-01-21 16:01:11 +01:00
parent bdbaab25a4
commit d7e9e8b8de
11 changed files with 54 additions and 56 deletions

View File

@@ -1,4 +1,5 @@
import type { Box } from '@nodarium/types';
import type { Color } from 'three';
import { Vector3 } from 'three/src/math/Vector3.js';
import Component from './Debug.svelte';
import { lines, points, rects } from './store';
@@ -11,7 +12,6 @@ export function debugPosition(x: number, y: number) {
}
export function debugRect(rect: Box) {
console.log(rect);
rects.update((r) => {
r.push(rect);
return r;

View File

@@ -109,7 +109,7 @@ export class GraphManager extends EventEmitter<{
const serialized = {
id: this.graph.id,
settings: $state.snapshot(this.settings),
meta: this.graph.meta,
meta: $state.snapshot(this.graph.meta),
nodes,
edges
};
@@ -274,7 +274,7 @@ export class GraphManager extends EventEmitter<{
})
);
const edges = graph.edges.map((edge) => {
this.edges = graph.edges.map((edge) => {
const from = nodes.get(edge[0]);
const to = nodes.get(edge[2]);
if (!from || !to) {
@@ -287,8 +287,6 @@ export class GraphManager extends EventEmitter<{
return [from, edge[1], to, edge[3]] as Edge;
});
this.edges = [...edges];
this.nodes.clear();
for (const [id, node] of nodes) {
this.nodes.set(id, node);
@@ -305,7 +303,7 @@ export class GraphManager extends EventEmitter<{
this.status = 'loading';
this.id = graph.id;
logger.info('loading graph', graph);
logger.info('loading graph', { nodes: graph.nodes, edges: graph.edges, id: graph.id });
const nodeIds = Array.from(new Set([...graph.nodes.map((n) => n.type)]));
await this.registry.load(nodeIds);
@@ -645,6 +643,13 @@ export class GraphManager extends EventEmitter<{
if (this.currentUndoGroup) return;
const state = this.serialize();
this.history.save(state);
// This is some stupid race condition where the graph-manager emits a save event
// when the graph is not fully loaded
if (this.nodes.size === 0 && this.edges.length === 0) {
return;
}
this.emit('save', state);
logger.log('saving graphs', state);
}

View File

@@ -70,12 +70,6 @@
}
});
$effect(() => {
if (settingTypes && settings) {
manager.setSettings(settings);
}
});
manager.on("settings", (_settings) => {
settingTypes = { ...settingTypes, ..._settings.types };
settings = _settings.values;