-
Notifications
You must be signed in to change notification settings - Fork 5
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
feat: add renderError property #175
Conversation
EgorKluch
commented
Jun 15, 2023
- Add renderErrorView prop for custom render and handle errors
- Reset error on data prop change
src/components/ChartKit.tsx
Outdated
<ErrorBoundary onError={props.onError}> | ||
<ErrorBoundary | ||
onError={props.onError} | ||
resetError={handleResetError} |
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's seems, resetError
bad prop name - it's callback or fallback, I don't know...
Preview is ready. |
resetError: () => void; | ||
}; | ||
|
||
export type ErrorBoundaryRenderErrorView = ( |
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 wanted to add more readable type, but it's forbidden.
export declare namespace ErrorBoundary {
export type RenderErrorViewOpts = {
message: string;
error: ChartKitError | Error;
resetError: () => void;
};
export type RenderErrorView = (opts: RenderErrorViewOpts) => React.ReactNode
}
// ...
renderErrorView?: ErrorBoundary.RenderErrorView;
Why namespaces are forbidden?
3b04066
to
964b3fe
Compare
b836554
to
cf4e49b
Compare
cf4e49b
to
fe4af3f
Compare