Skip to content
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

Issue/483 Hitting tab after rapid entry shows red input box as opposed to waiting till debounced suggestions is returned and selecting matching suggestion and moving to next field #484

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/components/assistants/generic/value-assistant.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,12 @@ export class ValueAssistant extends Assistant {
@Bind
onTypedTextChanged (newText) {
this.setState({
activeSuggestion: -1,
typedText: newText
});
if (this.machineState) {
this.machineState.previewValue = null;
}
}

@Bind
Expand Down
9 changes: 6 additions & 3 deletions src/components/builders/generic/value-builder.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,15 @@ export class ValueBuilder extends Builder {
}

@Bind
@Debounce(250) // 250ms debounce
handleKeyUp (e) {
this.machineState.typedText = e.target.value; // inform state of typed text
this.getSuggestions(e);
}

@Debounce(250)
getSuggestions (e) {
const boxed = this.machine.boxedValue;
this.machineState.fetchSuggestions(this.machineState.unformatUnboxedValue(e.target.value, boxed), boxed, e.target.value);
// inform state of typed text
this.machineState.typedText = e.target.value;
}

focus () {
Expand Down