-
Notifications
You must be signed in to change notification settings - Fork 272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(store)!: fully rework and add auto save #1550
Conversation
To be honest, I wonder why |
|
😮 makes sense then, I don't think we can do synchronous commands right now with Tauri's IPC? The way we currently do thing is having something in the Rust side and give js side the ability to interact with it but things will stay in the Rust side, #15 means we either need the ability to do synchronous IPC or we reverse the process and make rust side request data from the js side |
Nope, and i doubt we'll see this any time soon.
I mean, it's totally fine to not want to "solve" #15 i just think we never thought much about it. |
fn drop(&mut self) { | ||
let auto_save_debounce_sender = self.auto_save_debounce_sender.lock().unwrap(); | ||
if let Some(ref sender) = *auto_save_debounce_sender { | ||
let _ = sender.send(AutoSaveMessage::Cancel); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are you sure we want to cancel on drop? shouldn't we force save here instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I forget why I did this too be honest, we probably should move this to save
instead, not sure we really need to do anything on drop
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should also add a JS option to configure the debounce delay, but i'll take this
really good work btw |
following the refactor from tauri-apps/plugins-workspace#1550
@lucasfernog What do you think about these? Currently we're doing nothing on exit, this is different from what we used to do, also do you think we should just prevent duplicated stores with the same path or maybe add a function to share a store with a name? |
yes I think that's reasonable |
I'll need to think about this a bit more on how to do it, I will be out for a few hours, can get back on is when I'm back |
* Add auto save to store plugin * Put jsdoc at constructor instead of class level * Clippy * Use enum instead of bool * Some(AutoSaveMessage::Cancel) | None * from_millis * u64 * Add change file * Rename to emit_on_change * should use Duration in `with_store` * Add breaking change notice to change file * Emit change event for inserts by reset * Update readme example * Update example * Remove extra line * Make description clear it only works with managed * Fix links in docstring * Fix doc string closing * get_mut * Proof of concept * fmt * Load store on create * cargo fmt * Fix merge conflits * Format * small cleanup * update docs, use `impl Into<JsonValue>` * fix doctests, further simplification of api * add store options --------- Co-authored-by: Tillmann <28728469+tweidinger@users.noreply.github.com> Co-authored-by: Lucas Nogueira <lucas@tauri.app>
* Add auto save to store plugin * Put jsdoc at constructor instead of class level * Clippy * Use enum instead of bool * Some(AutoSaveMessage::Cancel) | None * from_millis * u64 * Add change file * Rename to emit_on_change * should use Duration in `with_store` * Add breaking change notice to change file * Emit change event for inserts by reset * Update readme example * Update example * Remove extra line * Make description clear it only works with managed * Fix links in docstring * Fix doc string closing * get_mut * Proof of concept * fmt * Load store on create * cargo fmt * Fix merge conflits * Format * small cleanup * update docs, use `impl Into<JsonValue>` * fix doctests, further simplification of api * add store options --------- Co-authored-by: Tillmann <28728469+tweidinger@users.noreply.github.com> Co-authored-by: Lucas Nogueira <lucas@tauri.app>
Where is the file stored by config plugin? |
Not sure what do you mean by config plugin, if you mean the store plugin, you can see the path used with |
Found it, thanks! @Legend-Master |
Closes #1535
Rework and add a setting to enable a store to debounce save on modification (on calls like set, clear, delete, reset)