Skip to content

Commit

Permalink
fix: Handle bad filter param
Browse files Browse the repository at this point in the history
  • Loading branch information
adityachoudhari26 committed Oct 19, 2024
1 parent b362cbb commit f1c5621
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ export const useReleaseFilter = () => {
const filter = useMemo<ReleaseCondition | undefined>(() => {
const filterJson = urlParams.get("filter");
if (filterJson == null) return undefined;
return JSON.parse(LZString.decompressFromEncodedURIComponent(filterJson));
try {
return JSON.parse(LZString.decompressFromEncodedURIComponent(filterJson));
} catch {
return undefined;
}
}, [urlParams]);

const setFilter = useCallback(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ export const useTargetFilter = () => {
const filter = useMemo<TargetCondition | undefined>(() => {
const filterJson = urlParams.get("filter");
if (filterJson == null) return undefined;
return JSON.parse(LZString.decompressFromEncodedURIComponent(filterJson));
try {
return JSON.parse(LZString.decompressFromEncodedURIComponent(filterJson));
} catch {
return undefined;
}
}, [urlParams]);

const setFilter = useCallback(
Expand Down

0 comments on commit f1c5621

Please sign in to comment.