-
Notifications
You must be signed in to change notification settings - Fork 282
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(store)!: more reworks (#1860)
* refactor(store): more reworks * Enable auto save by default * Store to resource table by default * Remove share store * Clean up * Add close store * Add store function * Add lazy store * Add init to lazy store * refresh cache in example * Add get-or-create-store * Revert "Add get-or-create-store" This reverts commit 7ffd769. * try get first * Docs * Use absolute path for store * more docs * Allow js to use pre-stored (de)serialize functions * Fix js get and close store * Show case how to use pretty json * Update readme * Use store instead of `store_builder` in example * Build * Fix example * More docs for StoreBuilder::build * Add default (de)serialize fn * Use pretty json by default * Use `undefined` for empty value in get * Change files * Differentiate json null from no value for events * Add create or existing * Build * Rename inner store's inset method to set * Update readme * Apply suggestions from code review * Use close instead * Update breaking changes * Return result in resolve_store_path * Change to close_resource and take &self * Clean up * Apply suggestions from code review Co-authored-by: Amr Bashir <[email protected]> * Remove unused pub(crate) * Update change file * Expose resolve_store_path * Remove with_store * Remove StoreInner from pub and expose is_empty * Fix wrong jsdoc param * Update readme * rename createOrExistingStore to createOrLoad * make api consistent with the JS implementation, add examples * fmt * reintroduce "get existing store" behavior for create_or_load * rename createOrLoad to newOrExisting * keep store lock throughout whole new_or_existing_inner * Remove load * Missed if load * Don't make StoreState public * Remove R: Runtime from Builder * rename newOrExisting to load, load to reload * update docs * rename missing reload fn * rename builder fn to build() * fix default permission * Fix description and create_new logic * Clippy * Update docs * Update docs * remove create_store command * remove close_store command since we extend from Resource * Revert "remove close_store command since we extend from Resource" This reverts commit 4a29fc8. * Reapply "remove close_store command since we extend from Resource" This reverts commit 70a1830. --------- Co-authored-by: Amr Bashir <[email protected]> Co-authored-by: Lucas Nogueira <[email protected]>
- Loading branch information
1 parent
cfd48b3
commit 8c67d44
Showing
20 changed files
with
1,058 additions
and
507 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
"store-js": minor:feat | ||
--- | ||
|
||
- Add `getStore` | ||
- Add an option to use pre-stored (de)serialize functions (registered on rust) | ||
- Add `LazyStore` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
"store": minor:breaking | ||
--- | ||
|
||
### Breaking changes: | ||
|
||
- Renamed `StoreCollection` to `StoreState` | ||
- `StoreBuilder::build` now returns a `Result` | ||
- `StoreExt::store` now returns `Result<Arc<Store>>` | ||
|
||
### Enhancements: | ||
|
||
- Save and cancel pending auto save on drop | ||
- Use absolute path as store's key, fix #984 | ||
- Share store to resource table by default | ||
- Enable auto save with 100ms debounce time by default | ||
- Use pretty json by default, close #1690 | ||
|
||
### New features: | ||
|
||
- Add `get_store` to get shared stores across js and rust side | ||
- Add default (de)serialize functions settings `default_serialize_fn` and `default_deserialize_fn` | ||
- Allow js to use pre-stored (de)serialize functions registered by `register_serialize_fn` and `register_deserialize_fn` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.