-
Notifications
You must be signed in to change notification settings - Fork 285
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
refactor(store)!: more reworks #1860
Conversation
Package Changes Through 8e71393There are 10 changes which include dialog with patch, dialog-js with patch, positioner with patch, positioner-js with patch, http with patch, http-js with patch, shell with patch, shell-js with patch, store-js with minor, store with minor Planned Package VersionsThe following package releases are the planned based on the context of changes in this pull request.
Add another change file through the GitHub UI by following this link. Read about change files or the docs at github.com/jbolda/covector |
can't we automatically share the store? like always make it available in the same collection, so a call from another language would pick it up anyway? |
Yeah I was thinking about it, but that means you'll need to always preserve that store, sometimes you might just want to read the data from it and forget about it, maybe share/preserve it by default, and add a close function or something |
I need to take a break, this thing is haunting me right now 😂 |
Note: don't merge it yet, I didn't have the time to test and write the docs yet, got some other things to handle, might be able get back on this tomorrow or something like that |
To be honest, I still find |
I've removed the create function from the Rust side, maybe we do the same on the JS side too. I'll push this change for you to take a look. |
@amrbashir i wanted to use the Resource class close() method instead of creating a dedicated one but I can't because we're using the AppHandle resource table and not the Webview one.. should the resources plugin allow me to configure which table i'm referring to? or fallback to other tables? |
I was thinking something similar but Idk if the auditors will approve, maybe if we allow only closing resources from the same webview, or the same window or the app handle, It should be fine then. |
I.e. webview can't close resources from other webviews. |
yeah so fallback to the parent window or AppHandle, that should be good |
usually you shouldn't even know the RID if you can't also close the resource.. otherwise users can use a wrapper ID instead |
This reverts commit 70a1830.
all good for us to merge and release this? @amrbashir and @Legend-Master |
Except for |
we'll fix on the tauri side |
this changes the resource plugin close() API to fallback to the parent window and AppHandle resource tables, letting the JS to delete global resources. The need for this was brought up on tauri-apps/plugins-workspace#1860 (comment) the store plugin stores the resources in the AppHandle, and we want the existing close() API to work on global resources otherwise every consumer needs their own resource close commands
…11398) this changes the resource plugin close() API to fallback to the parent window and AppHandle resource tables, letting the JS to delete global resources. The need for this was brought up on tauri-apps/plugins-workspace#1860 (comment) the store plugin stores the resources in the AppHandle, and we want the existing close() API to work on global resources otherwise every consumer needs their own resource close commands
* 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 <amr.bashir2015@gmail.com> * 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 <amr.bashir2015@gmail.com> Co-authored-by: Lucas Nogueira <lucas@tauri.app>
Follow up of #1550
Changes:
create_store
when there're still active stores with the same path aliveNew features:
getStore
/get_store
share stores across js and rust sideDefault changes: