solidjs-community / solid-primitives

A library of high-quality primitives that extend SolidJS reactivity.
https://primitives.solidjs.community
MIT License
1.23k stars 121 forks source link

[storage] Sync Support for `tauriStorage` #678

Open jaydevelopsstuff opened 2 weeks ago

jaydevelopsstuff commented 2 weeks ago

Describe The Problem To Be Solved

Currently, it seems there is no method for syncing changes with the tauriStorage storage backend.

Suggest A Solution

The JS API for Tauri's Store plugin (which the current impl uses) has an onChange method which can be used to receive any changes to the store via a callback, even if they are made from other windows or the Rust backend.

onChange fires anytime the store is modified, even when the change was made in the same window, so that will need to be taken into account to avoid infinite loops.

atk commented 2 weeks ago

Internal changes are already reactive. The next step is to support a tauri file watcher (supported since v2).