mirror of
https://github.com/stashapp/stash.git
synced 2026-01-06 07:38:49 +01:00
Fix studio display after clearing
This commit is contained in:
parent
a4f0a80816
commit
becf2769e7
1 changed files with 10 additions and 8 deletions
|
|
@ -58,16 +58,18 @@ export const FilterSelect: React.FunctionComponent<IProps> = (props: IProps) =>
|
|||
|
||||
/* eslint-disable react-hooks/rules-of-hooks */
|
||||
const [selectedItem, setSelectedItem] = React.useState<ValidTypes | undefined>(undefined);
|
||||
const [isInitialized, setIsInitialized] = React.useState<boolean>(false);
|
||||
/* eslint-enable */
|
||||
|
||||
if (!!props.initialId && !selectedItem && !isInitialized) {
|
||||
const initialItem = items.find((item) => props.initialId === item.id);
|
||||
if (!!initialItem) {
|
||||
setSelectedItem(initialItem);
|
||||
setIsInitialized(true);
|
||||
React.useEffect(() => {
|
||||
if (!!items) {
|
||||
const initialItem = items.find((item) => props.initialId === item.id);
|
||||
if (!!initialItem) {
|
||||
setSelectedItem(initialItem);
|
||||
} else {
|
||||
setSelectedItem(undefined);
|
||||
}
|
||||
}
|
||||
}
|
||||
}, [props.initialId, items]);
|
||||
/* eslint-enable */
|
||||
|
||||
const renderItem: ItemRenderer<ValidTypes> = (item, itemProps) => {
|
||||
if (!itemProps.modifiers.matchesPredicate) { return null; }
|
||||
|
|
|
|||
Loading…
Reference in a new issue