-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Display an error message when the service is unreachable #8490
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
This PR improves error handling when the backend service is unreachable by removing blocking UI behavior and adding clear error messaging.
- Removed
ClientConfigProvider
component to prevent UI blocking when client config fails to load - Added error snackbar notification in
ClientConfigProviderEffect
when backend is unreachable - Added
isClientConfigLoaded
check inUserProviderEffect
to prevent unnecessary network requests - Modified
PageChangeEffect
to check client config status before tracking analytics - Updated test decorators to reflect new non-blocking architecture
6 file(s) reviewed, 4 comment(s)
Edit PR Review Bot Settings | Greptile
<ClientConfigProviderEffect /> | ||
<ClientConfigProvider> | ||
<ChromeExtensionSidecarEffect /> | ||
<ChromeExtensionSidecarProvider> | ||
<UserProviderEffect /> | ||
<UserProvider> | ||
<AuthProvider> | ||
<ApolloMetadataClientProvider> | ||
<ObjectMetadataItemsProvider> | ||
<PrefetchDataProvider> | ||
<AppThemeProvider> | ||
<SnackBarProvider> | ||
<DialogManagerScope dialogManagerScopeId="dialog-manager"> | ||
<DialogManager> | ||
<StrictMode> | ||
<PromiseRejectionEffect /> | ||
<GotoHotkeysEffectsProvider /> | ||
<PageTitle title={pageTitle} /> | ||
<Outlet /> | ||
</StrictMode> | ||
</DialogManager> | ||
</DialogManagerScope> | ||
</SnackBarProvider> | ||
</AppThemeProvider> | ||
</PrefetchDataProvider> | ||
<PageChangeEffect /> | ||
</ObjectMetadataItemsProvider> | ||
</ApolloMetadataClientProvider> | ||
</AuthProvider> | ||
</UserProvider> | ||
</ChromeExtensionSidecarProvider> | ||
</ClientConfigProvider> | ||
<ChromeExtensionSidecarEffect /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: ClientConfigProviderEffect and ChromeExtensionSidecarEffect may try to make API calls before SnackBarProvider is mounted, potentially losing error messages
if (error !== undefined) { | ||
enqueueSnackBar('Unable to reach backend', { | ||
variant: SnackBarVariant.Error, | ||
}); | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: setIsClientConfigLoaded(false) should be called here to ensure the state accurately reflects the failed load
@@ -90,5 +102,7 @@ export const ClientConfigProviderEffect = () => { | |||
setIsAnalyticsEnabled, | |||
]); | |||
|
|||
console.log('error: ', error, loading); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: remove console.log before merging to production
<ClientConfigProviderEffect /> | ||
<ClientConfigProvider> | ||
<UserProviderEffect /> | ||
<UserProvider> | ||
<ApolloMetadataClientMockedProvider> | ||
<ObjectMetadataItemsProvider> | ||
<FullHeightStorybookLayout> | ||
<HelmetProvider> | ||
<SnackBarProviderScope snackBarManagerScopeId="snack-bar-manager"> | ||
<IconsProvider> | ||
<PrefetchDataProvider> | ||
<Outlet /> | ||
</PrefetchDataProvider> | ||
</IconsProvider> | ||
</SnackBarProviderScope> | ||
</HelmetProvider> | ||
</FullHeightStorybookLayout> | ||
</ObjectMetadataItemsProvider> | ||
</ApolloMetadataClientMockedProvider> | ||
</UserProvider> | ||
</ClientConfigProvider> | ||
<UserProviderEffect /> | ||
<UserProvider> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: UserProviderEffect depends on client config being loaded, but now runs regardless of client config status. This could cause cascading errors if client config fails
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's causing any issues here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
(updates since last review)
This PR continues the error handling improvements by implementing comprehensive error capture and display mechanisms across the application.
- Added
PromiseRejectionEffect
to catch and display unhandled promise rejections via snackbar - Moved
ClientConfigProviderEffect
afterSnackBarProvider
in provider hierarchy to ensure error messages are displayed - Added error handling for
ObjectMetadataItemNotFoundError
with specific error message - Added Sentry integration placeholder in
PromiseRejectionEffect
for future error tracking
3 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile
}); | ||
return; | ||
} | ||
if (isDefined(data?.clientConfig)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: consider adding an else clause to handle undefined clientConfig case explicitly
Thanks a lot!!! |
Thanks for taking a look at this. I have had the same experience while working on this project. When this happened for the first time to me, I was a bit confused and couldn't quite figure out how to resolve it other than running the |
@khuddite we discussed it internally and we think it's better not to change the structure like you did but simply reuse Do you want us to take care of it or do you want to give it another try? Thanks! |
Thanks for providing the direction. Yeah, I've also noticed that something is not quite correct when I saw many storybook tests have failed for different reasons in consequence. And fixing them didn't seem straightforward. I will give it another try. |
Great thanks a lot! |
- fix Icon variable Plus - add search input - fix dropdown height ## Before ![image](https://github.com/user-attachments/assets/49f73efd-21cc-4ecd-a494-f51edc34dc57) ## After ![image](https://github.com/user-attachments/assets/2af2c7ee-72fd-4dae-a1ef-19e75e1ac026)
fixing twentyhq#7375 --------- Co-authored-by: guillim <guillaume@twenty.com>
fix twentyhq#8204 I changed "API keys" to "API values". Stopped inputting special characters in Select field option keys. @lucasbordeau please check the changes and tell me if I need to do any other changes. :) --------- Co-authored-by: Félix Malfait <felix@twenty.com>
Fixes: twentyhq#8483 Co-authored-by: Félix Malfait <felix@twenty.com>
First step of twentyhq#6868 Adds min.., max.. queries for DATETIME fields adds min.., max.., avg.., sum.. queries for NUMBER fields (count distinct operation and composite fields such as CURRENCY handling will be dealt with in a future PR) <img width="1422" alt="Capture d’écran 2024-11-06 à 15 48 46" src="https://github.com/user-attachments/assets/4bcdece0-ad3e-4536-9720-fe4044a36719"> --------- Co-authored-by: Charles Bochet <charles@twenty.com> Co-authored-by: Weiko <corentin@twenty.com>
This reverts commit 5c7f48283529ef7644493f73e4967249c463a1a8.
This reverts commit 92ea9a220cf2a9b35958b964700dbe5709fcd756.
…achable" This reverts commit abccf584d84b6ea44edc613fe04671ada8a3f0e2.
@khuddite Thanks for the PR! We will review it shortly, in the meantime, could you fix the conflicts so we can test it functionally (sorry, the project is still evolving quite fast!) |
@charlesBochet I am so sorry, I should've converted it to a draft. This PR is not ready for review just yet. I am still in the middle of making changes and following the direction provided by @FelixMalfait |
@khuddite might be easier if you start from scratch again instead of solving the many conflict? Don't mind if I close this one and you re-open it with the simplied approach we discussed, starting from a fresh |
That makes sense, sure go ahead! |
Fixes #8487
Summary
We block the rest of the UI if we fail to fetch client config from the back-end for whatever reason. Therefore, a white screen is displayed without any feedback whenever that happens.
ClientConfigProvider
is the component that blocks UI when the client config has not been loaded.Solution
It ended up being more changes than I anticipated but those changes were necessary. I removed
ClientConfigProvider
to unblock the rest of the UI even if the back-end is unreachable. UsedenqueueSnackBar
to display an error message when the client config failed to load. UsedisClientConfigLoaded
in a couple of places to ensure no further requests are made if client config fetch fails.Recording
CleanShot.2024-11-13.at.17.01.03.mp4
Honestly, I am unsure if it's the best way to tackle the issue, but I'd like to receive feedback on this.