Skip to content

Commit

Permalink
fix: correctly restore selected streaming service filters (sct#3249)
Browse files Browse the repository at this point in the history
  • Loading branch information
sct authored and Mike Kao committed Jan 3, 2024
1 parent a6142f7 commit af7a2f4
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 af7a2f4

Please sign in to comment.