mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-09-22 21:30:44 +02:00
refactor(store)!: reset to defaults before merging the on-disk state in reload (#3599)
* refactor(store)!: reset to defaults before merging the on-disk state in reload
`Store::reload` / `reload()` previously merged the on-disk state into the
current in-memory store. It now resets the store to its defaults first,
so in-memory keys that are neither in the defaults nor on disk are
dropped. `reload_ignore_defaults` / `reload({ ignoreDefaults: true })`
is unchanged.
* test(store): cover reload resetting to the defaults before merging the on-disk state
---------
Co-authored-by: Lucas Nogueira <lucas@crabnebula.dev>
This commit is contained in:
co-authored by
Lucas Nogueira
parent
b7897cab5d
commit
b566f09124
@@ -405,9 +405,9 @@ interface IStore {
|
||||
* This method is useful if the on-disk state was edited by the user and you want to synchronize the changes.
|
||||
*
|
||||
* Note:
|
||||
* - This method loads the data and merges it with the current store,
|
||||
* this behavior will be changed to resetting to default first and then merging with the on-disk state in v3,
|
||||
* to fully match the store with the on-disk state, set {@linkcode ReloadOptions | ignoreDefaults} to `true`
|
||||
* - This method resets the store to its defaults and then merges the on-disk state into it,
|
||||
* so keys that are neither in the defaults nor on disk are dropped.
|
||||
* To fully match the store with the on-disk state (ignoring defaults), set {@linkcode ReloadOptions | ignoreDefaults} to `true`
|
||||
* - This method does not emit change events.
|
||||
*
|
||||
* @returns
|
||||
|
||||
Reference in New Issue
Block a user