-
Notifications
You must be signed in to change notification settings - Fork 7
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
fix: fixed ignored error, added toast for error messages #65
base: main
Are you sure you want to change the base?
Conversation
@@ -172,6 +169,7 @@ export const WebZjsProvider = ({ children }: { children: React.ReactNode }) => { | |||
|
|||
return ( | |||
<WebZjsContext.Provider value={{ state, dispatch }}> | |||
<Toaster /> |
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 think it should be outside the context as a Toaster component is a placeholder for toast renders. So probably we can locate it in component
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.
Toaster component should be in parent rather then every component that needs to display error.
Alternatively it has its wrapper for displaying errors across the app. For current scope it only displays WebZjsContext-s errors.
const timeout = setTimeout(() => { | ||
dispatch({ type: 'set-error', payload: null }); | ||
}, 10000); |
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.
this logic clears the errors as webz-wallet might have some during the sync state, but it will keep running anyway. So this logic is still required
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.
It cleared WebZjsContext-s state.error
which wasn't even used in the app, it was just set and cleared for no reason.
Now its used by react-hot-toast which removes the toast after set duration.
Closes #62