fragment icon indicating copy to clipboard operation
fragment copied to clipboard

Triggers for Keyboard and MIDI not saving `key` param in local storage

Open FabienMotte opened this issue 2 years ago • 2 comments

Hi @raphaelameaume! First, congrats on the awesome work done to build this tool! 👏

I've noticed that the triggers for Keyboard and MIDI using the UI are not working. The key param doesn't seem to be persisted in the local storage as you can see on the screenshot below.

image

Thanks for your help!

FabienMotte avatar Sep 01 '22 22:09 FabienMotte

Thanks for the kind words Fabien, and the reporting of this issue.

Indeed, there was a mixed-up between the custom and native events firing from <Input.svelte>. In this case, the callback to register the trigger expects a custom event and receive a native one, being unable to split the keys properly before saving to localStorage.

Considering <TextInput> is only used in <Params> and <FieldTrigger>, I think we can safely dispatch a CustomEvent from Input.svelte to mimic the behaviour of the on:change callback.

But this gets me thinking into having both CustomEvent and the native one. Currently the on:change event is overridden in order to align every kind of input and being able to apply those change to whatever props we pass through from the sketch file. If we change this behaviour to keep the native one and dispatch a more "custom" one (so with a different name), this would have more consequences overall but maybe more future proof.

Will work on this for the next minor release

raphaelameaume avatar Sep 02 '22 10:09 raphaelameaume

Thanks @raphaelameaume for the detailed explanation!

FabienMotte avatar Sep 02 '22 12:09 FabienMotte

Solved in #21

raphaelameaume avatar Sep 07 '22 13:09 raphaelameaume