Skip to content

Commit

Permalink
refactor: cache tiddlersToNotSave to speed up
Browse files Browse the repository at this point in the history
  • Loading branch information
linonetwo committed Nov 4, 2024
1 parent 307807d commit 083e91f
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class TidGiMobileFileSystemSyncAdaptor {
wikiStorageService: WikiStorageService;
workspaceID: string;
recipe?: string;
tiddlersToNotSave: string[];

constructor(options: { wiki: Wiki }) {
if (window.service?.wikiStorageService === undefined) {
Expand All @@ -59,6 +60,7 @@ class TidGiMobileFileSystemSyncAdaptor {
this.isLoggedIn = false;
this.isReadOnly = false;
this.logoutIsAvailable = true;
this.tiddlersToNotSave = $tw.utils.parseStringArray(this.wiki.getTiddlerText('$:/plugins/linonetwo/expo-file-system-syncadaptor/TiddlersToNotSave') ?? '');
// React-Native don't have fs monitor, so no SSE on mobile
// this.setupSSE();
}
Expand Down Expand Up @@ -234,8 +236,7 @@ class TidGiMobileFileSystemSyncAdaptor {
}
try {
const title = tiddler.fields.title;
const tiddlersToNotSave = $tw.utils.parseStringArray(this.wiki.getTiddlerText('$:/plugins/linonetwo/expo-file-system-syncadaptor/TiddlersToNotSave') ?? '');
if (tiddlersToNotSave.includes(title)) {
if (this.tiddlersToNotSave.includes(title)) {
this.logger.log(`Ignore saveTiddler ${title}, config in TiddlersToNotSave`);
// if not calling callback in sync adaptor, will cause it waiting forever
callback(null);
Expand Down

0 comments on commit 083e91f

Please sign in to comment.