Skip to content

Commit

Permalink
fix: update comparators to handle undefined value for booleans (#549)
Browse files Browse the repository at this point in the history
  • Loading branch information
mayan-000 authored Mar 13, 2024
1 parent ec5e70c commit 22f2015
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
10 changes: 7 additions & 3 deletions packages/cli-dashboard/src/hooks/useCookieListing.tsx/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ import {
calculateEffectiveExpiryDate,
type CookieTableData,
} from '@ps-analysis-tool/common';

/**
* Internal dependencies
*/
import calculateDynamicFilterValues from './utils/calculateDynamicFilterValues';
import calculateBlockedReasonsFilterValues from './utils/calculateBlockedReasonsFilterValues';

Expand Down Expand Up @@ -154,7 +158,7 @@ const useCookieListing = (
},
useGenericPersistenceKey: true,
comparator: (value: InfoType, filterValue: string) => {
const val = value as boolean;
const val = Boolean(value);
return val === (filterValue === 'First Party');
},
},
Expand All @@ -174,7 +178,7 @@ const useCookieListing = (
},
useGenericPersistenceKey: true,
comparator: (value: InfoType, filterValue: string) => {
const val = value as boolean;
const val = Boolean(value);
return val === (filterValue === 'True');
},
},
Expand Down Expand Up @@ -211,7 +215,7 @@ const useCookieListing = (
},
useGenericPersistenceKey: true,
comparator: (value: InfoType, filterValue: string) => {
const val = value as boolean;
const val = Boolean(value);
return val === (filterValue === 'True');
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ const useCookieListing = (domainsInAllowList: Set<string>) => {
},
useGenericPersistenceKey: true,
comparator: (value: InfoType, filterValue: string) => {
const val = value as boolean;
const val = Boolean(value);
return val === (filterValue === 'First Party');
},
},
Expand All @@ -270,7 +270,7 @@ const useCookieListing = (domainsInAllowList: Set<string>) => {
},
useGenericPersistenceKey: true,
comparator: (value: InfoType, filterValue: string) => {
const val = value as boolean;
const val = Boolean(value);
return val === (filterValue === 'True');
},
},
Expand Down Expand Up @@ -307,7 +307,7 @@ const useCookieListing = (domainsInAllowList: Set<string>) => {
},
useGenericPersistenceKey: true,
comparator: (value: InfoType, filterValue: string) => {
const val = value as boolean;
const val = Boolean(value);
return val === (filterValue === 'True');
},
},
Expand Down

0 comments on commit 22f2015

Please sign in to comment.