-
Notifications
You must be signed in to change notification settings - Fork 254
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
After upgrade to v2: invalid args rid
for command get
: command get missing required key rid
#1877
Comments
Can you post the output of the |
This method of declaring store no longer works: https://v2.tauri.app/plugin/store/. I've followed the migration but I'm now stuck because the create_store command apparently expects a u64 rather than a boolean
which has already been mentionned here and can be circumvented by using a number instead of a boolean when declaring the autoSave option Some issues with stable it seems |
Further to yesterday, I'm now seeing this error on Store construction:
tauri info:
|
I can't load data after upgrading from v2.0.0-rc to v2.0.1 . |
the same problem😭
|
You guys need to change the way you declare the store after updating to plugin-store v2 -> https://v2.tauri.app/plugin/store/ |
The bug still happens for me with this code snippet |
Thanks, it works. from const clipboardStore = new window.__TAURI_PLUGIN_STORE__.Store('clipboard.bin'); to const { createStore } = window.__TAURI__.store;
// ...
const clipboardStore = await createStore('clipboard.bin'); |
I've updated my code to follow the V2 docs, this generated a new error passing the
I omitted that option and just call store.save() after setting a value. I updated my capabilities for the plugin too (to use const Setting = {
windowSplit: "window:split"
}
class WindowSettings {
#defaults
#store
constructor(defaults, store) {
this.#defaults = defaults
this.#store = store
}
#saveSetting(key, value) {
this.#store.set(key, value).then(() => this.#store.save())
}
getSplit = () =>
this.#store.get(Setting.windowSplit).then(split =>
typeof split !== "number"
? this.#defaults.split.min
: Math.min(
Math.max(split, this.#defaults.split.min),
this.#defaults.split.max
)
)
setSplit = px => {
this.#saveSetting(Setting.windowSplit, px)
}
...
} I use a hook for store instantiation and updated my app to show a loading component if the store isn't set / ready. import React from "react"
import { createStore } from "@tauri-apps/plugin-store"
import Settings from "../settings"
function useSettings(defaults, storeFile = "settings.bin") {
const [settings, setSettings] = React.useState(null)
React.useEffect(() => {
const initSettings = async () => {
const store = await createStore(storeFile)
setSettings(new Settings(defaults, store))
}
initSettings()
}, [])
return settings
}
export default useSettings Conditional render in App: ...
const defaultSettings = React.useMemo(() => {
return {
split: {
max: leftSideMax + resizeBarWidth,
min: minWidth
}
}
}, [minWidth, leftSideMax, resizeBarWidth])
const settings = useWindowSettings(defaultSettings)
...
if (!settings) {
return (<Loading />)
}
...
// render app UI as usual, settings available |
Oh oops I opened #1931 before seeing this. But it seems that But for autoSave, it seems like the rust is using it as a u64 because it's using it to define debounce. But those changes aren't reflected in the JS, and I'm not sure which we should want to do:
edit: It looks like more changes are in the pipeline already, and I see this change being reflected in those changes, so probably this will be more clear after this pr.
|
I also encountered this issue, should we update this version? |
I'm seeing many of these console errors in the webview2 inspector after updating tauri and tauri-plugin-store from 2.0.0-rc to 2.0.0 final. The error points to the plugin-store, or my call point:
store.get("my-key")
. No code changed, just Cargo and npm package upgrades to @tauri-apps v2 release.My code:
I've tried changing my key names and store file (
.dat
), neither helped.The text was updated successfully, but these errors were encountered: