Skip to content

refactor: move FatalError to form-component lib#18912

Merged
Magnusrm merged 1 commit into
mainfrom
refactor/move-error-to-app
May 21, 2026
Merged

refactor: move FatalError to form-component lib#18912
Magnusrm merged 1 commit into
mainfrom
refactor/move-error-to-app

Conversation

@Magnusrm
Copy link
Copy Markdown
Contributor

@Magnusrm Magnusrm commented May 21, 2026

Description

  • Migrates FatalError and FatalErrorEmpty from src/App/frontend/src/app-components/error to libs/form-component/src/app-components/FatalError, and updates all 10 consumers in src/App/frontend to import from @app/form-component.
  • Adds Vitest unit tests and a Storybook story.

Verification

  • Related issues are connected (if applicable)
  • Your code builds clean without any errors or warnings
  • Manual testing done (required)
  • Relevant automated test added (if you find this hard, leave it and we'll help out)

Summary by CodeRabbit

Release Notes

  • Tests

    • Added comprehensive test coverage for fatal error component and empty error state handling.
  • Documentation

    • Added design documentation with visual previews for fatal error states.
  • Chores

    • Improved component organisation and consolidated error components within the form library.
    • Code cleanup and optimised import structure across components.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 21, 2026

📝 Walkthrough

Walkthrough

This pull request relocates the FatalError and FatalErrorEmpty error components from frontend-specific paths into the shared @app/form-component library. The components undergo minor refactoring (removing unused React imports, streamlining JSX), receive comprehensive test coverage and Storybook documentation, and all consuming frontend files are updated to import from the new shared location.

Changes

FatalError component library migration

Layer / File(s) Summary
FatalError component implementation and cleanup
libs/form-component/src/app-components/FatalError/FatalError.tsx, libs/form-component/src/app-components/FatalError/FatalErrorEmpty.tsx
FatalError and FatalErrorEmpty components drop unused React default imports and streamline JSX formatting whilst preserving the same rendered structure and prop handling.
FatalError test coverage
libs/form-component/src/app-components/FatalError/FatalError.test.tsx
React Testing Library tests verify FatalError renders children within a data-fatal-error wrapper, forwards arbitrary props to the underlying div, and FatalErrorEmpty renders as a hidden empty div.
FatalError module exports and library integration
libs/form-component/src/app-components/FatalError/index.ts, libs/form-component/src/app-components/index.ts
FatalError module index establishes public re-exports and the form-component barrel export includes the module in the public API surface.
FatalError Storybook stories
libs/form-component/src/app-components/FatalError/FatalError.stories.tsx
Storybook metadata and two stories document FatalError rendering with default children and FatalErrorEmpty as a hidden marker element.
Frontend consumer import migration
src/App/frontend/src/components/altinnError.tsx, src/App/frontend/src/layout/GenericComponent.tsx, src/App/frontend/src/layout/SigneeList/SigneeListError.tsx, src/App/frontend/src/layout/SigneeList/SigneeListSummary.tsx, src/App/frontend/src/layout/SigningActions/SigningActionsComponent.tsx, src/App/frontend/src/layout/SigningDocumentList/SigningDocumentListError.tsx, src/App/frontend/src/layout/Subform/SubformComponent.tsx, src/App/frontend/src/layout/Subform/Summary/SubformSummaryComponent.tsx, src/App/frontend/src/layout/Subform/Summary/SubformSummaryTable.tsx
Twelve frontend files update their FatalError imports to use @app/form-component instead of relative src/app-components paths, consolidating error UI imports with other form components.
Monorepo changed-paths documentation
src/App/frontend/monorepo-changed-paths.txt
The tracked paths file removes a settings file reference, documents the relocated FatalError and FatalErrorEmpty components, and adds the new InstantiationError.tsx file.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested labels

skip-releasenotes, kind/chore

Suggested reviewers

  • adamhaeger
  • framitdavid
  • phlipsterit

Poem

A rabbit hops through error paths,
Moving components left and right,
From scattered src/ to shared lib's way—
Now FatalError shines so bright! 🐰✨

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'refactor: move FatalError to form-component lib' accurately and clearly summarises the main change: migrating the FatalError component to a shared library.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The pull request description is complete and follows the repository template with all required sections filled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/move-error-to-app

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Magnusrm Magnusrm linked an issue May 21, 2026 that may be closed by this pull request
@Magnusrm Magnusrm marked this pull request as ready for review May 21, 2026 09:14
@github-actions github-actions Bot added the skip-releasenotes Issues that do not make sense to list in our release notes label May 21, 2026
Copy link
Copy Markdown
Contributor

@JamalAlabdullah JamalAlabdullah 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! 👍

@Magnusrm Magnusrm merged commit b22ed17 into main May 21, 2026
34 of 41 checks passed
@Magnusrm Magnusrm deleted the refactor/move-error-to-app branch May 21, 2026 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-releasenotes Issues that do not make sense to list in our release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move "error" components into lib

2 participants