docs(store): reload merges the value

pull/2843/head
Tony 5 days ago
parent 6210cd31df
commit c4d8ea515a
No known key found for this signature in database
GPG Key ID: 34BDD3EA27824956

@ -396,7 +396,12 @@ 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 does not emit change events.
* Note:
* - This method loads the data and merges it with the current store,
* this behavior will be changed to overriding from on-disk state in v3,
* for now, call {@linkcode clear} first for the store to fully match the on-disk state
* - This method does not emit change events.
*
* @returns
*/
reload(): Promise<void>

@ -284,6 +284,8 @@ impl<R: Runtime> StoreInner<R> {
}
/// Update the store from the on-disk state
///
/// Note: This method loads the data and merges it with the current store
pub fn load(&mut self) -> crate::Result<()> {
let bytes = fs::read(&self.path)?;
@ -499,6 +501,12 @@ impl<R: Runtime> Store<R> {
}
/// Update the store from the on-disk state
///
/// Note:
/// - This method loads the data and merges it with the current store,
/// this behavior will be changed to overriding from on-disk state in v3,
/// for now, call [`clear`](Self::clear) first for the store to fully match the on-disk state
/// - This method does not emit change events
pub fn reload(&self) -> crate::Result<()> {
self.store.lock().unwrap().load()
}

Loading…
Cancel
Save