Skip to content

feat: Add error page for blocking content#107

Open
lornakelly wants to merge 1 commit intoserverlessworkflow:mainfrom
lornakelly:83/blocking-error
Open

feat: Add error page for blocking content#107
lornakelly wants to merge 1 commit intoserverlessworkflow:mainfrom
lornakelly:83/blocking-error

Conversation

@lornakelly
Copy link
Copy Markdown
Contributor

@lornakelly lornakelly commented Apr 20, 2026

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

  • Add ErrorPage and ParsingErrorPage
  • Show ParsingErrorPage when model === null i.e when diagram rendering should not be attempted
  • Add relevant translations
  • Remove fr dictionary and translations as MVP only requires en
  • Add test utilities
    • renderWithProviders - render function that wraps components with providers
    • translation t() helper - gets the translated text for a given translation key so tests dont break if strings are updated
  • Add stories and story tests
  • Add tests
Screenshot 2026-04-20 at 11 05 26

Future Work

  • Add styling to error pages

Copilot AI review requested due to automatic review settings April 20, 2026 08:59
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 ErrorPage and ParsingErrorPage components and wired them into DiagramEditor when model === null.
  • Updated i18n to add workflow error translations and removed the fr dictionary (MVP: en only).
  • 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 fr dictionary, passing an unsupported props.locale (e.g. "fr") will cause createI18n to fall back to returning translation keys (e.g. workflowError.title) instead of English strings. Consider clamping props.locale to Object.keys(dictionaries) (fallback to detectLocale/"en" when unsupported) and/or tightening DiagramEditorProps['locale'] to keyof typeof dictionaries so 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>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

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.

feat: Handle blocking content errors

2 participants