Skip to content

Commit

Permalink
Merge pull request #218 from ECN/bugfix-queueselector-loading-when-qu…
Browse files Browse the repository at this point in the history
…eue-doesnt-exist

Changed Autocomplete loading prop value to be same as loading variable value; Changed noOptionsText to be more specific
  • Loading branch information
campb303 authored Jul 8, 2021
2 parents 2bbb316 + 4cf1888 commit 09776be
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions 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 All @@ -39,11 +40,11 @@ export default function QueueSelector({ open, setOpen, value, setValue }) {

const theme = useTheme();
const useStyles = makeStyles({
Paper_root: {
Paper_root: {
margin: theme.spacing(1)
}
});
const classes = useStyles();
});
const classes = useStyles();

// Prepopulate Active Queues from Cookies
useEffect( _ => {
Expand Down Expand Up @@ -152,14 +153,16 @@ 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={`'${searchValue}' queue does not exist.`}
size="small"
open={open}
onOpen={_ => setOpen(true)}
onClose={_ => setOpen(false)}
loading={true}
loading={loading}
disableCloseOnSelect
disableListWrap
fullWidth
Expand Down

0 comments on commit 09776be

Please sign in to comment.