Skip to content

Commit

Permalink
fix: error when loading $:/Import that don't have text and file
Browse files Browse the repository at this point in the history
  • Loading branch information
linonetwo committed Sep 11, 2023
1 parent 01d0661 commit b342fc7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/services/BackgroundSyncService/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,15 @@ export class BackgroundSyncService {
if ('bag' in fieldsWithoutText) delete fieldsWithoutText.bag;
if ('revision' in fieldsWithoutText) delete fieldsWithoutText.revision;

let text;
try {
text = skinnyTiddlerWithText.text ?? (await fs.readAsStringAsync(getWikiTiddlerPathByTitle(wiki, title)));
} catch (error) {
console.error(`Failed to load file ${title} in getChangeLogsSinceLastSync ${(error as Error).message}`);
}
const fields = {
...fieldsWithoutText,
text: skinnyTiddlerWithText.text ?? (await fs.readAsStringAsync(getWikiTiddlerPathByTitle(wiki, title))),
text,
} satisfies ITiddlerFieldsParam;

result.fields = fields;
Expand Down
2 changes: 1 addition & 1 deletion src/services/WikiStorageService/ignoredTiddler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
export const getSyncIgnoredTiddlers = (
title?: string,
) => [...((title?.startsWith('Draft of ') || title?.startsWith('$:/temp') || title?.startsWith('$:/state')) ? [title] : []), '$:/StoryList', '$:/layout'];
) => [...((title?.startsWith('Draft of ') || title?.startsWith('$:/temp') || title?.startsWith('$:/state')) ? [title] : []), '$:/StoryList', '$:/layout', '$:/Import'];
/**
* Tiddlers that should save to SQLite as full tiddlers. Like plugins that starts with `$:/`.
*
Expand Down

0 comments on commit b342fc7

Please sign in to comment.