Skip to content

QueueSelector shows loading message when item not found instead of not found message #190

Closed
campb303 opened this issue Feb 9, 2021 · 1 comment · Fixed by #218
Closed
Assignees
Labels
bug An issue that results in webqueue2 breaking quickfix Immediately actionable and should be fast

Comments

@campb303
Copy link
Collaborator

campb303 commented Feb 9, 2021

image

@campb303 campb303 added bug An issue that results in webqueue2 breaking frontend labels Feb 9, 2021
@campb303 campb303 added this to the v1-proof-of-concept milestone Feb 9, 2021
@campb303 campb303 self-assigned this Feb 9, 2021
@campb303 campb303 added this to To do in v1.0 Mar 8, 2021
@campb303 campb303 removed the frontend label Mar 17, 2021
@campb303 campb303 removed this from To do in v1.0 Mar 29, 2021
@campb303 campb303 added the quickfix Immediately actionable and should be fast label Apr 9, 2021
@wrigh393 wrigh393 assigned wrigh393 and unassigned campb303 Jun 29, 2021
@wrigh393
Copy link
Collaborator

The loading prop of the Autocomplete component was set to always be true instead of being set to whatever the current state of the loading variable we created was. This prevented the component from displaying the text MUI provides when the user types in an option that isn't valid. Setting this loading prop to be the same as the loading variable allowed that text to display.

In order to make the text more specific to the component, I passed the noOptionsText prop and set the string to display "Queue doesn't exist" when the user types in a queue that is not valid. Below is a code diff to show the code that changed to make this work.

options={queueCounts}
value={value}
onChange={handleChange}
getOptionLabel={(option) => `${option.name} (${option.number_of_items})`}
renderOption={optionRenderer}
getOptionSelected={(option, value) => option.name === value.name}
+ noOptionsText={"Queue does not exist"}
size="small"
open={open}
onOpen={_ => setOpen(true)}
onClose={_ => setOpen(false)}
+ loading={loading}
- loading={true}
disableCloseOnSelect
disableListWrap
fullWidth
multiple
autoHighlight

This code is ready for a PR.

Sign in to join this conversation on GitHub.
Labels
bug An issue that results in webqueue2 breaking quickfix Immediately actionable and should be fast
Projects
None yet
2 participants