From 32e5a3ec94bd938be619dca1ad7450ef6e8f7d86 Mon Sep 17 00:00:00 2001 From: Zef Hemel Date: Tue, 12 Jul 2022 12:30:36 +0200 Subject: [PATCH] Use "store" syscall to keep index and version state --- packages/plugs/core/editor.ts | 12 ++++++------ packages/plugs/core/page.ts | 5 ++++- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/packages/plugs/core/editor.ts b/packages/plugs/core/editor.ts index 8d79a81..13ed2ce 100644 --- a/packages/plugs/core/editor.ts +++ b/packages/plugs/core/editor.ts @@ -1,4 +1,4 @@ -import { get, set } from "@silverbulletmd/plugos-silverbullet-syscall"; +import { get, set } from "@plugos/plugos-syscall/store"; import { flashNotification } from "@silverbulletmd/plugos-silverbullet-syscall/editor"; import { getVersion, @@ -8,22 +8,22 @@ import { export async function editorInit() { let currentVersion = await getVersion(); console.log("Running version check", currentVersion); - let lastVersion = await get("index", "$silverBulletVersion"); + let lastVersion = await get("$silverBulletVersion"); console.log("Last version", lastVersion); if (lastVersion !== currentVersion) { await flashNotification( "Version update detected, going to reload plugs..." ); - await set("index", "$spaceIndexed", false); - await set("index", "$silverBulletVersion", currentVersion); + await set("$spaceIndexed", false); + await set("$silverBulletVersion", currentVersion); invokeFunction("client", "updatePlugsCommand"); } else { - let spaceIndexed = await get("index", "$spaceIndexed"); + let spaceIndexed = await get("$spaceIndexed"); console.log("Space indexed", spaceIndexed); if (!spaceIndexed) { await invokeFunction("client", "reindexSpaceCommand"); // Resetting this, because part of the reindex will be to wipe this too - await set("index", "$silverBulletVersion", currentVersion); + await set("$silverBulletVersion", currentVersion); } } } diff --git a/packages/plugs/core/page.ts b/packages/plugs/core/page.ts index 9e353ad..2bfc186 100644 --- a/packages/plugs/core/page.ts +++ b/packages/plugs/core/page.ts @@ -6,6 +6,9 @@ import { queryPrefix, set, } from "@silverbulletmd/plugos-silverbullet-syscall/index"; + +import { set as storeSet } from "@plugos/plugos-syscall/store"; + import { flashNotification, getCurrentPage, @@ -189,7 +192,7 @@ async function getBackLinks(pageName: string): Promise { export async function reindexCommand() { await flashNotification("Reindexing..."); await invokeFunction("server", "reindexSpace"); - await set("index", "$spaceIndexed", true); + await storeSet("$spaceIndexed", true); await flashNotification("Reindexing done"); }