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

feat(sanity): add config for onUncaughtError #7553

Merged
merged 22 commits into from
Oct 7, 2024
Merged

feat(sanity): add config for onUncaughtError #7553

merged 22 commits into from
Oct 7, 2024

Conversation

RitaDias
Copy link
Contributor

@RitaDias RitaDias commented Sep 27, 2024

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

  • Does the code make sense?
  • Does the naming of the callback make sense?
  • I tried in other places, however, while discussing it with others in the team after not finding a place that would have context for the 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 the imageInput or the studioComponents and then going to the custom-components/structure workspace and seeing the console logs work

Notes for release

Adds ability to callback when an error happens and allows developers to use errors thrown by the studio

Copy link

vercel bot commented Sep 27, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
page-building-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 7, 2024 9:25am
performance-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 7, 2024 9:25am
test-compiled-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 7, 2024 9:25am
test-next-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 7, 2024 9:25am
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 7, 2024 9:25am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
studio-workshop ⬜️ Ignored (Inspect) Visit Preview Oct 7, 2024 9:25am

Copy link
Contributor

No changes to documentation

Copy link
Contributor

github-actions bot commented Sep 27, 2024

Component Testing Report Updated Oct 7, 2024 9:23 AM (UTC)

✅ All Tests Passed -- expand for details
File Status Duration Passed Skipped Failed
comments/CommentInput.spec.tsx ✅ Passed (Inspect) 45s 15 0 0
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 8s 3 0 0
formBuilder/inputs/PortableText/Annotations.spec.tsx ✅ Passed (Inspect) 31s 6 0 0
formBuilder/inputs/PortableText/copyPaste/CopyPaste.spec.tsx ✅ Passed (Inspect) 38s 11 7 0
formBuilder/inputs/PortableText/copyPaste/CopyPasteFields.spec.tsx ✅ Passed (Inspect) 0s 0 12 0
formBuilder/inputs/PortableText/Decorators.spec.tsx ✅ Passed (Inspect) 17s 6 0 0
formBuilder/inputs/PortableText/DisableFocusAndUnset.spec.tsx ✅ Passed (Inspect) 10s 3 0 0
formBuilder/inputs/PortableText/DragAndDrop.spec.tsx ✅ Passed (Inspect) 3m 0s 0 0 0
formBuilder/inputs/PortableText/FocusTracking.spec.tsx ✅ Passed (Inspect) 45s 15 0 0
formBuilder/inputs/PortableText/Input.spec.tsx ✅ Passed (Inspect) 1m 41s 21 0 0
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ✅ Passed (Inspect) 1m 17s 18 0 0
formBuilder/inputs/PortableText/PresenceCursors.spec.tsx ✅ Passed (Inspect) 9s 3 9 0
formBuilder/inputs/PortableText/RangeDecoration.spec.tsx ✅ Passed (Inspect) 26s 9 0 0
formBuilder/inputs/PortableText/Styles.spec.tsx ✅ Passed (Inspect) 18s 6 0 0
formBuilder/inputs/PortableText/Toolbar.spec.tsx ✅ Passed (Inspect) 37s 12 0 0
formBuilder/tree-editing/TreeEditing.spec.tsx ✅ Passed (Inspect) 0s 0 3 0
formBuilder/tree-editing/TreeEditingNestedObjects.spec.tsx ✅ Passed (Inspect) 0s 0 3 0

@@ -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()
Copy link
Contributor Author

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

Copy link
Contributor Author

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)

Copy link
Member

@bjoerge bjoerge left a 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.

dev/test-studio/sanity.config.ts Outdated Show resolved Hide resolved
Copy link
Member

@bjoerge bjoerge left a comment

Choose a reason for hiding this comment

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

Great work, @RitaDias!

@RitaDias RitaDias added this pull request to the merge queue Oct 7, 2024
Merged via the queue into next with commit e3cf177 Oct 7, 2024
56 of 59 checks passed
@RitaDias RitaDias deleted the edx-1601 branch October 7, 2024 15:30
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.

3 participants