Skip to content

Commit

Permalink
fix: lazy load tiddler saved as empty one
Browse files Browse the repository at this point in the history
fixes #68
  • Loading branch information
linonetwo committed Nov 4, 2024
1 parent 083e91f commit 0d5160e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,10 @@ class TidGiMobileFileSystemSyncAdaptor {
return;
}
try {
// Similar to https://github.com/TiddlyWiki/TiddlyWiki5/blob/master/core/modules/server/routes/put-tiddler.js#L36 but we just stop saving, and wait for lazy-load on client to complete, and let client to save again later.
if (tiddler.fields._is_skinny) {
return;
}
const title = tiddler.fields.title;
if (this.tiddlersToNotSave.includes(title)) {
this.logger.log(`Ignore saveTiddler ${title}, config in TiddlersToNotSave`);
Expand Down
7 changes: 4 additions & 3 deletions src/services/WikiStorageService/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ import { getFullSaveTiddlers } from './ignoredTiddler';
* All methods must be async.
*/
export class WikiStorageService {
#workspace: IWikiWorkspace;
#configStore = useConfigStore;
#serverStore = useServerStore;
readonly #workspace: IWikiWorkspace;
readonly #configStore = useConfigStore;
readonly #serverStore = useServerStore;

constructor(workspace: IWikiWorkspace) {
this.#workspace = workspace;
Expand All @@ -50,6 +50,7 @@ export class WikiStorageService {
*/
async saveTiddler(title: string, fields: ITiddlerFieldsParam): Promise<string> {
try {
/** Tiddlers that should save to SQLite as full tiddlers. Like plugins that starts with `$:/` */
const saveFullTiddler = getFullSaveTiddlers(title).includes(title);
const { text, title: _, ...fieldsObjectToSave } = fields as (ITiddlerFieldsParam & { text?: string; title: string });
const changeCount = '0'; // this.wikiInstance.wiki.getChangeCount(title).toString();
Expand Down

0 comments on commit 0d5160e

Please sign in to comment.