Skip to content
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

chore: merging global error toast with client lib + some refactoring #938

Merged
merged 7 commits into from
Feb 15, 2023

Conversation

nicolasburtey
Copy link
Member

No description provided.

@nicolasburtey nicolasburtey marked this pull request as draft January 22, 2023 22:12
@nicolasburtey nicolasburtey force-pushed the chore--merging-global-error-with-client-lib branch 3 times, most recently from bb526b2 to 991b9c4 Compare January 24, 2023 07:30
@@ -102,7 +129,70 @@ const GaloyClient: React.FC<{ children: React.ReactNode }> = ({ children }) => {
}),
)

const splitLink = split(
const errorLink = onError(({ graphQLErrors, networkError: networkErrorRaw }) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has this been tested at all? My concern is that since the error link is executed for each query, if we make multiple queries at the same time, we will see multiple instances of the same toast issue. In the past, it seems the checks for network errors were psuedo-batched by being processed all at once.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to make some testing around this.

Where is batching done by the previous code?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously the check for errors only ran once after every render with the useEffect, so if multiple errors came back in between renders it would only run once.

Copy link
Contributor

@UncleSamtoshi UncleSamtoshi Jan 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how common that is however. Also not sure if the retry logic here will trigger the error link for each retry or just once.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so I've tested it locally.

basically from my test: the old code didn't work anymore, or at least even if the server was stopped, there was no error showing up.

with the new code, the toast is showing up. It' not reappearing in an annoying way. if you move screen, it may reappear if you deeper in the flow and are loader new graphql queries that are not watched yet. if you go "back there" is no error message.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where does setNetworkError get called to clear the error after a toast has been shown?

@nicolasburtey nicolasburtey force-pushed the chore--merging-global-error-with-client-lib branch from 991b9c4 to 1533100 Compare January 25, 2023 11:08
@nicolasburtey nicolasburtey force-pushed the chore--merging-global-error-with-client-lib branch 2 times, most recently from 70f79f9 to 71bdd8c Compare February 4, 2023 14:57
@nicolasburtey nicolasburtey force-pushed the chore--merging-global-error-with-client-lib branch 3 times, most recently from 276f597 to aa0c9f3 Compare February 8, 2023 09:31
@nicolasburtey nicolasburtey marked this pull request as ready for review February 8, 2023 11:07
@nicolasburtey nicolasburtey dismissed UncleSamtoshi’s stale review February 8, 2023 11:07

comment should have been addressed

@nicolasburtey nicolasburtey force-pushed the chore--merging-global-error-with-client-lib branch 7 times, most recently from d6732fc to e149342 Compare February 12, 2023 20:35
@nicolasburtey nicolasburtey force-pushed the chore--merging-global-error-with-client-lib branch 4 times, most recently from 7595f13 to 883e4f6 Compare February 15, 2023 08:55
@nicolasburtey nicolasburtey force-pushed the chore--merging-global-error-with-client-lib branch 2 times, most recently from 5c7788a to e98de9e Compare February 15, 2023 16:51
@nicolasburtey nicolasburtey force-pushed the chore--merging-global-error-with-client-lib branch from e98de9e to 92fda30 Compare February 15, 2023 16:52
app/graphql/client.tsx Outdated Show resolved Hide resolved
app/graphql/client.tsx Outdated Show resolved Hide resolved
@nicolasburtey nicolasburtey merged commit dbd7bb4 into main Feb 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants