Skip to content

Commit

Permalink
Modify noOptionsText to indicate what queue does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
campb303 committed Jul 8, 2021
1 parent 9d7131f commit 4cf1888
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/QueueSelector/QueueSelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const getQueueCounts = async (access_token) => {
export default function QueueSelector({ open, setOpen, value, setValue }) {
const [queueCounts, setQueueCounts] = useState([]);
const [isFirstRender, setIsFirstRender] = useState(true);
const [searchValue, setSearchValue] = useState("");
const access_token = useToken();
const loading = open && queueCounts.length === 0;

Expand Down Expand Up @@ -152,10 +153,11 @@ export default function QueueSelector({ open, setOpen, value, setValue }) {
options={queueCounts}
value={value}
onChange={handleChange}
onInputChange={(event, value, reason) => setSearchValue(value)}
getOptionLabel={(option) => `${option.name} (${option.number_of_items})`}
renderOption={optionRenderer}
getOptionSelected={ (option, value) => option.name === value.name }
noOptionsText={"Queue does not exist"}
noOptionsText={`'${searchValue}' queue does not exist.`}
size="small"
open={open}
onOpen={_ => setOpen(true)}
Expand Down

0 comments on commit 4cf1888

Please sign in to comment.