Skip to content
Open
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
7 changes: 1 addition & 6 deletions apps/obsidian/src/components/canvas/TldrawView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ export class TldrawView extends TextFileView {
const store = this.createStore(fileData, assetStore);

if (!store) {
console.warn("No tldraw data found in file");
return;
}

Expand All @@ -100,13 +99,11 @@ export class TldrawView extends TextFileView {
);

if (!match?.[1]) {
console.warn("No tldraw data found in file");
return;
}

const data = JSON.parse(match[1]) as TLData;
if (!data.raw) {
console.warn("Invalid tldraw data format - missing raw field");
return;
}
if (data.meta?.uuid) {
Expand All @@ -116,7 +113,6 @@ export class TldrawView extends TextFileView {
}

if (!this.file) {
console.warn("TldrawView not initialized: missing file");
return;
}

Expand Down Expand Up @@ -152,7 +148,6 @@ export class TldrawView extends TextFileView {
throw new Error("TldrawView not initialized: missing canvas UUID");

if (!this.assetStore) {
console.warn("Asset store is not set");
return;
}

Expand Down Expand Up @@ -254,4 +249,4 @@ export class TldrawView extends TextFileView {
this.assetStore = null;
}
}
}
}
15 changes: 4 additions & 11 deletions apps/obsidian/src/components/canvas/utils/relationJsonUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,10 @@ export const addRelationToRelationsJson = async ({
const destId = await getNodeInstanceIdForFile(plugin, targetFile);

if (!sourceId || !destId) {
// [PG-G2] Removed console.warn
const missing: string[] = [];
if (!sourceId) missing.push(`source (${sourceFile.basename})`);
if (!destId) missing.push(`target (${targetFile.basename})`);
console.warn(
"Could not resolve nodeInstanceIds for relation files:",
missing.join(", "),
);
new Notice(
"Could not create relation: one or both files are not discourse nodes or metadata is not ready.",
3000,
Expand Down Expand Up @@ -73,10 +70,8 @@ export const addRelationIfRequested = async (
getNodeTypeIdForFile(plugin, createdOrSelectedFile),
getNodeTypeIdForFile(plugin, relationshipTargetFile),
]);
// [PG-G2] Removed console.warn
if (!typeA || !typeB) {
console.warn(
"addRelationIfRequested: could not resolve node types for one or both files",
);
return;
}

Expand All @@ -91,10 +86,8 @@ export const addRelationIfRequested = async (
} else if (relation.sourceId === relation.destinationId) {
sourceFile = createdOrSelectedFile;
targetFile = relationshipTargetFile;
// [PG-G2] Removed console.warn
} else {
console.warn(
"addRelationIfRequested: file node types do not match relation definition",
);
return;
}

Expand All @@ -104,4 +97,4 @@ export const addRelationIfRequested = async (
targetFile,
relationTypeId: relation.relationshipTypeId,
});
};
};
17 changes: 1 addition & 16 deletions apps/obsidian/src/services/QueryEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@ export class QueryEngine {
return [];
}
if (!this.dc) {
console.warn(
"Datacore API not available. Search functionality is not available.",
);
return [];
}

Expand Down Expand Up @@ -125,9 +122,6 @@ export class QueryEngine {
return [];
}
if (!this.dc) {
console.warn(
"Datacore API not available. Search functionality is not available.",
);
return [];
}

Expand Down Expand Up @@ -245,9 +239,6 @@ export class QueryEngine {
const candidates: BulkImportCandidate[] = [];

if (!this.dc) {
console.warn(
"Datacore API not available. Falling back to vault iteration.",
);
return this.fallbackScanVault(patterns, validNodeTypes);
}

Expand Down Expand Up @@ -290,9 +281,6 @@ export class QueryEngine {
);

if (!matchedNodeType) {
console.warn(
`No matching node type found for pattern with nodeTypeId: ${pattern.nodeTypeId}`,
);
continue;
}

Expand Down Expand Up @@ -348,7 +336,7 @@ export class QueryEngine {
}
}
} catch (error) {
console.warn("Error querying DataCore for imported file:", error);
// Silently fail and continue
}
}

Expand Down Expand Up @@ -403,9 +391,6 @@ export class QueryEngine {
);

if (!matchedNodeType) {
console.warn(
`No matching node type found for pattern with nodeTypeId: ${pattern.nodeTypeId}`,
);
continue;
}

Expand Down
32 changes: 13 additions & 19 deletions apps/obsidian/src/utils/fileChangeListener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export class FileChangeListener {
};
this.plugin.app.metadataCache.on("changed", this.metadataChangeCallback);

console.debug("FileChangeListener initialized");
// [PG-G2] Removed console.debug
}

/**
Expand Down Expand Up @@ -134,7 +134,7 @@ export class FileChangeListener {
return;
}

console.log(`File modified: ${file.path}`);
// [PG-G2] Removed console.log
this.queueChange(file.path, "content");
}

Expand All @@ -146,7 +146,7 @@ export class FileChangeListener {
return;
}

console.log(`File deleted: ${file.path}`);
// [PG-G2] Removed console.log
this.hasPendingOrphanCleanup = true;
this.resetDebounceTimer();
}
Expand All @@ -159,7 +159,7 @@ export class FileChangeListener {
return;
}

console.log(`File renamed: ${oldPath} -> ${file.path}`);
// [PG-G2] Removed console.log
this.queueChange(file.path, "title", oldPath);
}

Expand All @@ -186,9 +186,7 @@ export class FileChangeListener {
// In the future, this can detect specific relation changes
const cache = this.plugin.app.metadataCache.getFileCache(file);
if (cache?.frontmatter) {
console.debug(
`Metadata changed for ${file.path} (relation metadata placeholder)`,
);
// [PG-G2] Removed console.debug
}
}

Expand Down Expand Up @@ -235,7 +233,7 @@ export class FileChangeListener {
*/
private async processQueue(): Promise<void> {
if (this.isProcessing) {
console.debug("Sync already in progress, skipping");
// [PG-G2] Removed console.debug
return;
}

Expand Down Expand Up @@ -283,30 +281,26 @@ export class FileChangeListener {
}
}

// [PG-G2] Removed console.debug
if (processedFiles.length > 0) {
console.debug(
`Successfully processed ${processedFiles.length} file(s):`,
processedFiles,
);
// Successfully processed files
}

// [PG-G2] Removed console.warn
if (failedFiles.length > 0) {
console.warn(
`Failed to process ${failedFiles.length} file(s), will retry on next change:`,
failedFiles,
);
// Failed files will retry on next change
}

if (this.hasPendingOrphanCleanup) {
const deletedCount = await cleanupOrphanedNodes(this.plugin);
if (deletedCount > 0) {
console.debug(`Deleted ${deletedCount} orphaned node(s)`);
// [PG-G2] Removed console.debug
}
this.hasPendingOrphanCleanup = false;
}

if (processedFiles.length > 0 || failedFiles.length === 0) {
console.debug("Sync queue processed");
// [PG-G2] Removed console.debug
}
} catch (error) {
console.error("Error processing sync queue:", error);
Expand Down Expand Up @@ -342,6 +336,6 @@ export class FileChangeListener {
this.pendingCreates.clear();
this.isProcessing = false;

console.debug("FileChangeListener cleaned up");
// [PG-G2] Removed console.debug
}
}
16 changes: 1 addition & 15 deletions apps/obsidian/src/utils/importNodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,12 +354,6 @@ const fetchNodeContentForImport = async ({
full.created == null ||
full.last_modified == null
) {
if (!direct?.text) {
console.warn(`No direct variant found for node ${nodeInstanceId}`);
}
if (!full?.text) {
console.warn(`No full variant found for node ${nodeInstanceId}`);
}
return null;
}

Expand Down Expand Up @@ -458,12 +452,10 @@ const downloadFileFromStorage = async ({
.download(filehash);

if (error) {
console.warn(`Error downloading file ${filehash}:`, error);
return null;
}

if (!data) {
console.warn(`No data returned for file ${filehash}`);
return null;
}

Expand Down Expand Up @@ -858,7 +850,6 @@ const importAssetsForNode = async ({

if (!fileContent) {
errors.push(`Failed to download file: ${filepath}`);
console.warn(`Failed to download file ${filepath} (hash: ${filehash})`);
continue;
}

Expand Down Expand Up @@ -898,7 +889,6 @@ const importAssetsForNode = async ({

// Track path mapping (raw + normalized key so updateMarkdownAssetLinks can lookup by link text)
setPathMapping(filepath, targetPath);
console.log(`Imported asset: ${filepath} -> ${targetPath}`);
} catch (error) {
const errorMsg = `Error importing asset ${fileRef.filepath}: ${error}`;
errors.push(errorMsg);
Expand Down Expand Up @@ -1173,7 +1163,6 @@ export const importSelectedNodes = async ({
const importFolderPath = `import/${sanitizeFileName(spaceName)}`;
const spaceUri = spaceUris.get(spaceId);
if (!spaceUri) {
console.warn(`Missing URI for space ${spaceId}`);
for (const _node of nodes) {
failedCount++;
processedCount++;
Expand Down Expand Up @@ -1304,10 +1293,7 @@ export const importSelectedNodes = async ({

// Log asset import errors if any
if (assetImportResult.errors.length > 0) {
console.warn(
`Some assets failed to import for node ${node.nodeInstanceId}:`,
assetImportResult.errors,
);
// Errors are tracked in assetImportResult
}

// If title changed and file exists, rename it to match the new title
Expand Down
6 changes: 0 additions & 6 deletions apps/obsidian/src/utils/publishNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ const publishSchema = async ({
}

if (!schemaResponse.data) {
console.warn(
`Schema with nodeTypeId ${nodeTypeId} not found in space ${spaceId}`,
);
return; // Schema doesn't exist, skip publishing
}

Expand Down Expand Up @@ -298,9 +295,6 @@ export const publishNodeToGroup = async ({
link,
file.path,
);
if (attachment === null) {
console.warn("Could not find file for " + link);
}
return attachment;
})
.filter((a) => !!a);
Expand Down
Loading