describo / crate-builder-component

A VueJS UI component to build an RO-Crate
MIT License
6 stars 3 forks source link

Workaround for strange autocomplete behavior in WC/react #42

Closed beepsoft closed 1 year ago

beepsoft commented 1 year ago

When using the web component build of the create builder the autocomplete behaves strange as reported in #39. I found that the selection (the user typed text) is reset to its default value (undefined) for unknown reason.

While I don't know the exact root of the problem I found that if we make sure data.selection is in sync with the query string then it works in Vue as usual and also fixes the WC/react issues.

The data.selection is set in debouncedQuerySearch and not in querySearch because of the debounce the user may type some more chars while the search starts with the older query string and this causes some jittering in the input field.

marcolarosa commented 1 year ago

I've had a look and I don't think it works as you expect. By structuring the debounce like that the debounce is created every time the debounced function (data.debouncedQuerySearch) is run. I've just pushed a small change to your branch that restructures it slightly. Can you please check that it works for you? I've also added a simple story to help work on that component. Not sure if you need that.