plugins-workspace: After upgrade to v2: invalid args `rid` for command `get`: command get missing required key rid
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:
import { Store } from "@tauri-apps/plugin-store"
const Setting = {
editorOpen: "editor-visible",
windowSplit: "window-split"
}
class WindowSettings {
#defaults
#store
constructor(defaults, store = new Store(".settings.dat")) {
this.#defaults = defaults
this.#store = store
}
#saveSetting(key, value) {
this.#store.set(key, value).then(() => this.#store.save())
}
/**
* Return bounded split value in pixels
* @returns number
*/
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’ve tried changing my key names and store file (.dat), neither helped.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 3
- Comments: 16 (5 by maintainers)
Thank you very much. I set the version of the store plugin to fine center and the problem is solved.
I’ve updated my code to follow the V2 docs, this generated a new error passing the
{ autoSave: true }option object:I omitted that option and just call store.save() after setting a value. Update:
{ autoSave: 1 }is accepted, no console errors.I updated my capabilities for the plugin too (to use
store:default) and rewrote the constructor of my class. I no longer construct the store if it’s not passed in. I moved store construction to a hook, ascreateStore()is async.I use a hook for store instantiation and updated my app to show a loading component if the store isn’t set / ready.
Conditional render in App:
the same problem😭
Your rust side store plugin’s version seems to be before the most recent rework, do you mind upgrading it to the latest and try again?
Thanks, it works.
from
to
@will5933 @antkit @gknapp
You guys need to change the way you declare the store after updating to plugin-store v2 -> https://v2.tauri.app/plugin/store/
Further to yesterday, I’m now seeing this error on Store construction:
invalid argsridfor commandget: invalid type: string ".settings.dat", expected u32tauri info:
Can you post the output of the
tauri infocommand please?