File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,8 @@ export function renderResponse<T>(
88 loadingMessages : string [ ] ,
99 onData : ( data : T ) => React . ReactElement
1010) : React . ReactElement | null {
11- if ( res . data ) return onData ( res . data ) ;
11+ // res.data might be false, so we check if it exists or is not undefined
12+ if ( res . data || res . data !== undefined ) return onData ( res . data ) ;
1213 if ( res . error ) return < ErrorView error = { res . error } /> ;
1314 if ( res . isValidating ) return < Loading steps = { loadingMessages } /> ;
1415 return null ;
Original file line number Diff line number Diff line change @@ -12,10 +12,9 @@ import { NotificationsSettings } from "./tabs/Settings/Settings";
1212import { LegacyNotifications } from "./tabs/Legacy" ;
1313
1414export const NotificationsRoot : React . FC = ( ) => {
15- const dnpsRequest = useApi . packagesGet ( ) ;
16- return renderResponse ( dnpsRequest , [ "Loading notifications" ] , ( ) => {
17- const isNotificationsPkgInstalled = useApi . notificationsIsInstalled ( ) ;
15+ const isNotificationsPkgInstalledRequest = useApi . notificationsIsInstalled ( ) ;
1816
17+ return renderResponse ( isNotificationsPkgInstalledRequest , [ "Loading notifications" ] , ( isInstalled ) => {
1918 const availableRoutes : {
2019 name : string ;
2120 subPath : string ;
@@ -24,12 +23,12 @@ export const NotificationsRoot: React.FC = () => {
2423 {
2524 name : "Inbox" ,
2625 subPath : subPaths . inbox ,
27- component : isNotificationsPkgInstalled . data ? Inbox : ( ) => < InstallNotificationsPkg />
26+ component : isInstalled ? Inbox : ( ) => < InstallNotificationsPkg />
2827 } ,
2928 {
3029 name : "Settings" ,
3130 subPath : subPaths . settings ,
32- component : isNotificationsPkgInstalled . data ? NotificationsSettings : ( ) => < InstallNotificationsPkg />
31+ component : isInstalled ? NotificationsSettings : ( ) => < InstallNotificationsPkg />
3332 } ,
3433 {
3534 name : "Legacy" ,
You can’t perform that action at this time.
0 commit comments