Skip to content

Add option to consolidate the state of all related point cuts, for a particular toggle feature, when one throws an error? #30

@TomStrepsil

Description

@TomStrepsil

The react-pointcuts package includes a React Error Boundary, designed to swap the "control" or "base" component, when an error is thrown.

Although this works for individual join points, where a feature includes disparate joins throughout a codebase, the enacting of fallback to only a subset of the code may leave the application in a Frankenstein state, which could be indeterminate / untested.

Although this "partial healing" may be seen as advantageous, it would be nice to provide the ability to configure a reset of the toggle state, to update the app consistently when this happens.

Currently, the factories exported by react-pointcuts receive a getActiveFeatures method, so honour unidirectional data binding to the toggle store. To allow for the error boundary to write back, a separate dispatch to that store will need to be provided, presumably hard-coded to reset the feature the join point is specifically bound to, and only being able to reset to the "control" state?

The withTogglePointFactory currently accepts a logError argument. Perhaps this could become onError, and handle both logging, and state reset? See: #42 / #44

N.B. Error Boundaries are "not a thing" for hooks, so although the withToggledHookFactory could respond to errors thrown in components, if they themselves error, there is current no safety net possible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions