plugins-workspace icon indicating copy to clipboard operation
plugins-workspace copied to clipboard

tauri-plugin-store: typescript mismatch for attribute autoSave

Open binarybaron opened this issue 1 year ago • 2 comments

The autoSave has the wrong type in the typescript definitions.

export type StoreOptions = {
    /**
     * Auto save on modification with debounce duration in milliseconds
     */
    autoSave?: boolean;
};

autoSave should be of type number, not boolean.

binarybaron avatar Oct 02 '24 15:10 binarybaron

So I believe the typescript definition is correct, but the rust one isn't, since a boolean makes sense here, but the command is actually the one complaining:

invalid args `autoSave` for command `create_store`: invalid type: boolean `true`, expected u64

After looking inside @Legend-Master's PR, it seems autoSave can actually be both, and yeah the rust definition needs soem update https://github.com/tauri-apps/plugins-workspace/pull/1860/files#diff-3724bbe06d5e960aae4085c2cc32c2ec0ea4315d8f3c0408ab415b79cce45105R61

Thanks @Legend-Master, will sit tight for this one

glumn avatar Oct 03 '24 14:10 glumn

The intention was to use number | undefined here since auto save was off by default, but this commit made a mistake so...

Anyways, in the new refactor #1860 I'm currently thinking we enable auto save by default and the option will be false to disable auto save, true | undefined for the default auto save duration, number for a custom auto save duration

Legend-Master avatar Oct 03 '24 15:10 Legend-Master