@@ -29,8 +29,8 @@ interface ConsentLookupModalProps {
29
29
const ConsentLookupModal = ( { isOpen, onClose } : ConsentLookupModalProps ) => {
30
30
const [ isSearching , setIsSearching ] = useState ( false ) ;
31
31
const [ searchResults , setSearchResults ] = useState <
32
- PreferenceWithNoticeInformation [ ]
33
- > ( [ ] ) ;
32
+ PreferenceWithNoticeInformation [ ] | undefined
33
+ > ( ) ;
34
34
const [ getCurrentPrivacyPreferencesTrigger ] =
35
35
useLazyGetCurrentPrivacyPreferencesQuery ( ) ;
36
36
@@ -41,7 +41,8 @@ const ConsentLookupModal = ({ isOpen, onClose }: ConsentLookupModalProps) => {
41
41
const { data, isError, error } = await getCurrentPrivacyPreferencesTrigger ( {
42
42
search,
43
43
} ) ;
44
- if ( isError ) {
44
+ const errorStatus = error && "status" in error && error ?. status ;
45
+ if ( isError && errorStatus !== 404 ) {
45
46
const errorMsg = getErrorMessage (
46
47
error ,
47
48
`A problem occurred while looking up the preferences.` ,
@@ -57,7 +58,7 @@ const ConsentLookupModal = ({ isOpen, onClose }: ConsentLookupModalProps) => {
57
58
const columns = useConsentLookupTableColumns ( ) ;
58
59
const tableInstance = useReactTable < PreferenceWithNoticeInformation > ( {
59
60
getCoreRowModel : getCoreRowModel ( ) ,
60
- data : searchResults ,
61
+ data : searchResults || [ ] ,
61
62
columns,
62
63
getRowId : ( row ) => `${ row . privacy_notice_history_id } ` ,
63
64
manualPagination : true ,
@@ -105,7 +106,11 @@ const ConsentLookupModal = ({ isOpen, onClose }: ConsentLookupModalProps) => {
105
106
tableInstance = { tableInstance }
106
107
emptyTableNotice = {
107
108
< Empty
108
- description = "Search for an email, phone number, or device ID."
109
+ description = {
110
+ searchResults === undefined
111
+ ? "Search for an email, phone number, or device ID."
112
+ : "No results found."
113
+ }
109
114
image = { Empty . PRESENTED_IMAGE_SIMPLE }
110
115
imageStyle = { { marginBottom : 15 } }
111
116
/>
0 commit comments