Skip to content

Commit

Permalink
fix: don't throw error on empty text
Browse files Browse the repository at this point in the history
  • Loading branch information
linonetwo committed Nov 4, 2024
1 parent 9b3b81b commit d5a5538
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ class TidGiMobileFileSystemSyncAdaptor {
const tiddlerText = await this.wikiStorageService.loadTiddlerText(title);
const tiddlerFields: ITiddlerFields = {
...tiddler.fields,
text: tiddlerText,
text: tiddlerText ?? '',
type: tiddler.fields.type ?? 'text/vnd.tiddlywiki',
_is_skinny: undefined,
revision: undefined,
Expand Down
6 changes: 2 additions & 4 deletions src/services/WikiStorageService/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,9 @@ export class WikiStorageService {
}
}

async loadTiddlerText(title: string): Promise<string> {
async loadTiddlerText(title: string): Promise<string | undefined> {
// try load from local, then from server. But usually, user sync full tiddlers store to here, so it this gives nothing, means that tiddler just don't have text, like calendar tiddlers may not have text.
const tiddlerText = (await this.#loadFromSqlite(title)) ?? (await this.#loadFromFS(title)) ?? await this.#loadFromServerAndSaveToFS(title);
if (tiddlerText === undefined) {
throw new Error(`${title} ${i18n.t('Log.FileNotSyncedYet')}`);
}
return tiddlerText;
}

Expand Down

0 comments on commit d5a5538

Please sign in to comment.