Skip to content

feat: add fault serialization adapter for react-router#98

Merged
adelrodriguez merged 1 commit intomainfrom
02-18-feat_add_fault_serialization_adapter_for_react-router
Feb 19, 2026
Merged

feat: add fault serialization adapter for react-router#98
adelrodriguez merged 1 commit intomainfrom
02-18-feat_add_fault_serialization_adapter_for_react-router

Conversation

@adelrodriguez
Copy link
Collaborator

@adelrodriguez adelrodriguez commented Feb 19, 2026

Add fault serialization for React Router

This PR adds serialization support for AppFault objects in React Router by:

  1. Creating a new serialization adapter in serialization.ts that handles conversion between AppFault objects and their serializable representation
  2. Registering the serializer with the React Start instance
  3. Exporting the isFault utility and SerializableFault type from the error package

This enables proper handling of fault objects when they're passed through React Router's loader/action data serialization process.

Greptile Summary

This PR adds serialization support for AppFault objects in React Router by creating a custom serialization adapter that handles conversion between AppFault instances and their serializable representation.

Changes made:

  • Created serialization.ts with faultSerializer adapter using TanStack Router's createSerializationAdapter API
  • Registered the serializer with the React Start instance to enable fault serialization across the application
  • Exported isFault utility and SerializableFault type from the error package for proper type support

The implementation enables AppFault objects to be safely passed through React Router's loader/action data flow, which requires serialization for SSR and data hydration.

Confidence Score: 5/5

  • This PR is safe to merge with no blocking issues
  • The implementation is clean, focused, and follows the proper TanStack Router serialization adapter pattern. All necessary exports are added, the adapter correctly uses AppFault.is() for testing, toSerializable() for serialization, and fromSerializable() for deserialization. The changes are minimal and well-contained across three files with clear separation of concerns.
  • No files require special attention

Important Files Changed

Filename Overview
apps/app/src/shared/server/serialization.ts New serialization adapter for handling AppFault objects in React Router loaders/actions
apps/app/src/start.ts Registered faultSerializer adapter with React Start instance
packages/error/src/index.ts Exported isFault utility and SerializableFault type from faultier

Sequence Diagram

sequenceDiagram
    participant Loader as Route Loader/Action
    participant RR as React Router
    participant FS as faultSerializer
    participant AF as AppFault

    Loader->>RR: Return AppFault object
    RR->>FS: test(value)
    FS->>AF: AppFault.is(value)
    AF-->>FS: true
    FS->>AF: value.toSerializable()
    AF-->>FS: SerializableFault
    RR->>RR: Serialize to JSON
    Note over RR: Transfer over network
    RR->>RR: Deserialize from JSON
    RR->>FS: fromSerializable(value)
    FS->>AF: AppFault.fromSerializable(value)
    AF-->>FS: AppFault instance
    FS-->>RR: AppFault instance
    RR->>Loader: Deliver AppFault to component
Loading

Last reviewed commit: cbbae85

@coderabbitai
Copy link

coderabbitai bot commented Feb 19, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 02-18-feat_add_fault_serialization_adapter_for_react-router

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.

@adelrodriguez adelrodriguez force-pushed the 02-18-refactor_replace_better-result_with_faultier_for_error_handling branch from 194a280 to 82e83d3 Compare February 19, 2026 03:52
@adelrodriguez adelrodriguez force-pushed the 02-18-feat_add_fault_serialization_adapter_for_react-router branch from 081be14 to e581b6a Compare February 19, 2026 03:53
@adelrodriguez adelrodriguez changed the base branch from 02-18-refactor_replace_better-result_with_faultier_for_error_handling to graphite-base/98 February 19, 2026 03:53
@adelrodriguez adelrodriguez force-pushed the 02-18-feat_add_fault_serialization_adapter_for_react-router branch from e581b6a to c821ad6 Compare February 19, 2026 04:00
@graphite-app graphite-app bot changed the base branch from graphite-base/98 to main February 19, 2026 04:01
@adelrodriguez adelrodriguez force-pushed the 02-18-feat_add_fault_serialization_adapter_for_react-router branch from c821ad6 to cbbae85 Compare February 19, 2026 04:01
@adelrodriguez adelrodriguez merged commit 84a3f2b into main Feb 19, 2026
8 checks passed
@adelrodriguez adelrodriguez deleted the 02-18-feat_add_fault_serialization_adapter_for_react-router branch February 19, 2026 04:07
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.

1 participant

Comments