fix: correctly restore selected streaming service filters (#3249)

pull/3250/head
Ryan Cohen 2 years ago committed by GitHub
parent 6fd11cf425
commit 154f3e72ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -76,8 +76,8 @@ const RegionSelector = ({
}, [value, regions, allRegion]); }, [value, regions, allRegion]);
useEffect(() => { useEffect(() => {
if (onChange && regions) { if (onChange && regions && selectedRegion) {
onChange(name, selectedRegion?.iso_3166_1 ?? ''); onChange(name, selectedRegion.iso_3166_1);
} }
}, [onChange, selectedRegion, name, regions]); }, [onChange, selectedRegion, name, regions]);

@ -307,10 +307,6 @@ export const WatchProviderSelector = ({
onChange(watchRegion, activeProvider); onChange(watchRegion, activeProvider);
}, [activeProvider, watchRegion, onChange]); }, [activeProvider, watchRegion, onChange]);
useEffect(() => {
setActiveProvider([]);
}, [watchRegion]);
const orderedData = useMemo(() => { const orderedData = useMemo(() => {
if (!data) { if (!data) {
return []; return [];
@ -335,7 +331,12 @@ export const WatchProviderSelector = ({
<RegionSelector <RegionSelector
value={watchRegion} value={watchRegion}
name="watchRegion" name="watchRegion"
onChange={(_name, value) => setWatchRegion(value)} onChange={(_name, value) => {
if (value !== watchRegion) {
setActiveProvider([]);
}
setWatchRegion(value);
}}
disableAll disableAll
watchProviders watchProviders
/> />

Loading…
Cancel
Save