-
Notifications
You must be signed in to change notification settings - Fork 427
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(sanity): add config for onUncaughtError #7553
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
packages/sanity/src/core/form/inputs/files/ImageInput/ImageInput.tsx
Outdated
Show resolved
Hide resolved
No changes to documentation |
Component Testing Report Updated Oct 7, 2024 9:23 AM (UTC) ✅ All Tests Passed -- expand for details
|
@@ -30,15 +33,30 @@ export function WorkspaceRouterProvider({ | |||
const history = useRouterHistory() | |||
const router = useMemo(() => createRouter({basePath, tools}), [basePath, tools]) | |||
const [state, onNavigate] = useRouterFromWorkspaceHistory(history, router, tools) | |||
const {onStudioError} = useSource() |
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.
catching the ErrorBoundary from StudioErrorBoundary
since it has the context it needs 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.
If there is a better place for this than this component I'd love to hear it, areas "above" didn't have the SourceContext needed (as far as I was able to tell)
9638d5d
to
490e32e
Compare
packages/sanity/src/structure/components/structureTool/StructureTitle.tsx
Outdated
Show resolved
Hide resolved
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.
Looks good, thank you for taking the time to add proper tests for this as well!
I left a few comments/suggestions, please take a look.
packages/sanity/src/core/studio/workspaceLoader/WorkspaceRouterProvider.tsx
Outdated
Show resolved
Hide resolved
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.
Great work, @RitaDias!
Description
Adds ability to callback when an error happens and allows developers to add custom error telemetry (for example)
I will drop the throw errors before merging, those are for testing purposes
What to review
useSource
, the current place where it exists seems to be the better option. If you all have any other suggestions I'd love to hear it!Testing
Automated tests are in place.
You can also manually trigger it by adding
throw new error("oh no new error)
within theimageInput
or thestudioComponents
and then going to thecustom-components/structure
workspace and seeing the console logs workNotes for release
Adds ability to callback when an error happens and allows developers to use errors thrown by the studio