diff --git a/.github/workflows/msrv-check.yml b/.github/workflows/msrv-check.yml index 894ecffa..a603e8f0 100644 --- a/.github/workflows/msrv-check.yml +++ b/.github/workflows/msrv-check.yml @@ -5,18 +5,18 @@ on: branches: - dev paths: - - '.github/workflows/msrv-check.yml' - - 'plugins/*/src/**' - - '**/Cargo.toml' - - '**/Cargo.lock' + - ".github/workflows/msrv-check.yml" + - "plugins/*/src/**" + - "**/Cargo.toml" + - "**/Cargo.lock" pull_request: branches: - dev paths: - - '.github/workflows/msrv-check.yml' - - 'plugins/*/src/**' - - '**/Cargo.toml' - - '**/Cargo.lock' + - ".github/workflows/msrv-check.yml" + - "plugins/*/src/**" + - "**/Cargo.toml" + - "**/Cargo.lock" concurrency: group: ${{ github.workflow }}-${{ github.ref }} diff --git a/plugins/store/README.md b/plugins/store/README.md index c76c354c..f48f03ba 100644 --- a/plugins/store/README.md +++ b/plugins/store/README.md @@ -64,7 +64,9 @@ await store.save(); // this manually saves the store, otherwise the store is onl ``` ### Persisting values + Values added to the store are not persisted between application loads unless: + 1. The application is closed gracefully (plugin automatically saves) 2. The store is manually saved (using `store.save()`) diff --git a/plugins/store/guest-js/index.ts b/plugins/store/guest-js/index.ts index 252f946e..cc6058d8 100644 --- a/plugins/store/guest-js/index.ts +++ b/plugins/store/guest-js/index.ts @@ -3,8 +3,7 @@ // SPDX-License-Identifier: MIT import { invoke } from "@tauri-apps/api/tauri"; -import { UnlistenFn } from "@tauri-apps/api/event"; -import { appWindow } from "@tauri-apps/api/window"; +import { listen, UnlistenFn } from "@tauri-apps/api/event"; interface ChangePayload { path: string; @@ -180,14 +179,11 @@ export class Store { key: string, cb: (value: T | null) => void ): Promise { - return await appWindow.listen>( - "store://change", - (event) => { - if (event.payload.path === this.path && event.payload.key === key) { - cb(event.payload.value); - } + return await listen>("store://change", (event) => { + if (event.payload.path === this.path && event.payload.key === key) { + cb(event.payload.value); } - ); + }); } /** @@ -198,13 +194,10 @@ export class Store { async onChange( cb: (key: string, value: T | null) => void ): Promise { - return await appWindow.listen>( - "store://change", - (event) => { - if (event.payload.path === this.path) { - cb(event.payload.key, event.payload.value); - } + return await listen>("store://change", (event) => { + if (event.payload.path === this.path) { + cb(event.payload.key, event.payload.value); } - ); + }); } }