Skip to content

Commit

Permalink
fix: correctly restore selected streaming service filters (#3249)
Browse files Browse the repository at this point in the history
  • Loading branch information
sct committed Jan 16, 2023
1 parent 6fd11cf commit 154f3e7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/components/RegionSelector/index.tsx
Expand Up @@ -76,8 +76,8 @@ const RegionSelector = ({
}, [value, regions, allRegion]);

useEffect(() => {
if (onChange && regions) {
onChange(name, selectedRegion?.iso_3166_1 ?? '');
if (onChange && regions && selectedRegion) {
onChange(name, selectedRegion.iso_3166_1);
}
}, [onChange, selectedRegion, name, regions]);

Expand Down
11 changes: 6 additions & 5 deletions src/components/Selector/index.tsx
Expand Up @@ -307,10 +307,6 @@ export const WatchProviderSelector = ({
onChange(watchRegion, activeProvider);
}, [activeProvider, watchRegion, onChange]);

useEffect(() => {
setActiveProvider([]);
}, [watchRegion]);

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

0 comments on commit 154f3e7

Please sign in to comment.