feat: Add error page for blocking content#107
feat: Add error page for blocking content#107lornakelly wants to merge 1 commit intoserverlessworkflow:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a dedicated UI error state to the Serverless Workflow diagram editor so that when workflow parsing fails in a diagram-blocking way (model === null), the editor renders an error page instead of attempting to render the diagram.
Changes:
- Added
ErrorPageandParsingErrorPagecomponents and wired them intoDiagramEditorwhenmodel === null. - Updated i18n to add workflow error translations and removed the
frdictionary (MVP:enonly). - Added Storybook stories + story tests, plus shared test utilities (
renderWithProviders,t()).
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/serverless-workflow-diagram-editor/src/diagram-editor/DiagramEditor.tsx | Renders ParsingErrorPage when the parsed model is null; updates locale selection logic usage. |
| packages/serverless-workflow-diagram-editor/src/diagram-editor/error-pages/ErrorPage.tsx | New generic error page component. |
| packages/serverless-workflow-diagram-editor/src/diagram-editor/error-pages/ParsingErrorPage.tsx | New parsing-specific error page using context errors + i18n keys. |
| packages/serverless-workflow-diagram-editor/src/i18n/locales/en.ts | Adds new workflow error translation keys/strings. |
| packages/serverless-workflow-diagram-editor/src/i18n/locales/index.ts | Removes fr from exported dictionaries. |
| packages/serverless-workflow-diagram-editor/src/core/workflowSdk.ts | Updates parse error message string. |
| packages/serverless-workflow-diagram-editor/tests/test-utils/render-helpers.tsx | Adds provider-wrapped render helper for tests. |
| packages/serverless-workflow-diagram-editor/tests/test-utils/translation-helpers.ts | Adds t() helper backed by the real en dictionary. |
| packages/serverless-workflow-diagram-editor/tests/test-utils/index.ts | Updates test-utils exports. |
| packages/serverless-workflow-diagram-editor/tests/diagram-editor/error-pages/ErrorPage.test.tsx | Adds unit tests for ErrorPage. |
| packages/serverless-workflow-diagram-editor/tests/diagram-editor/error-pages/ParsingErrorPage.test.tsx | Adds unit tests for ParsingErrorPage. |
| packages/serverless-workflow-diagram-editor/stories/ErrorPage.stories.ts | Adds Storybook stories for the new error page. |
| packages/serverless-workflow-diagram-editor/tests/diagram-editor/error-pages/ErrorPage.story.test.tsx | Adds story tests for ErrorPage stories. |
| packages/serverless-workflow-diagram-editor/stories/DiagramEditor.stories.ts | Uses a sample workflow fixture content in the story. |
| packages/serverless-workflow-diagram-editor/tests/diagram-editor/DiagramEditor.story.test.tsx | Minor Vitest API usage adjustment (test -> it). |
| packages/serverless-workflow-diagram-editor/tests/core/workflowSdk.integration.test.ts | Updates expected error message to match new wording. |
Comments suppressed due to low confidence (1)
packages/serverless-workflow-diagram-editor/src/diagram-editor/DiagramEditor.tsx:63
- After removing the
frdictionary, passing an unsupportedprops.locale(e.g."fr") will causecreateI18nto fall back to returning translation keys (e.g.workflowError.title) instead of English strings. Consider clampingprops.localetoObject.keys(dictionaries)(fallback todetectLocale/"en"when unsupported) and/or tighteningDiagramEditorProps['locale']tokeyof typeof dictionariesso unsupported locales can’t be passed accidentally.
const locale = React.useMemo(() => {
const supportedLocales = Object.keys(dictionaries);
return props.locale ?? detectLocale(supportedLocales);
}, [props.locale]);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Lorna-Kelly <lornakelly88@gmail.com>
e83cbc6 to
f40fac8
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 16 out of 16 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Closes: #83
Summary
Show an error page when the workflow cannot be rendered. When parsing fails in a way that prevents building the diagram, display error feedback instead of attempting to render.
Changes
ErrorPageandParsingErrorPageParsingErrorPagewhenmodel === nulli.e when diagram rendering should not be attemptedfrdictionary and translations as MVP only requiresenrenderWithProviders- render function that wraps components with providerst()helper - gets the translated text for a given translation key so tests dont break if strings are updatedFuture Work