Skip to content
This repository was archived by the owner on Dec 16, 2025. It is now read-only.
This repository was archived by the owner on Dec 16, 2025. It is now read-only.

Delegate internal flow pattern #67

@sanjarcode

Description

@sanjarcode

context

A new pattern (not a pattern actually a necessity), if a component does more than one things (ignore UNIX, since countably), it will have multiple internal states. If some, it's onChange handlers should give the state setter back (in addition to event), and second, have a prop that omits setting of state of the component.

Example: a tab component has two things, the tab state, and the content state. I experienced an issue once, where the person did some work in one content, and clicked other tab, so we showed a modal with 'cancel' and 'discard'. i.e. we need the click event, but want to capture control and defer the state change. Simplest possible approach is for the Tab component to pass the setter to us. This way we can add a flow, and defer the action whenever we want.

Of course, we'll need to pass a prop to avoid state calls, and use this onClickSafe event.

Simple.

conclusion

a general way to defer internal flow of one component, and getting control of that flow via the feature component.

name

"Delegate action pattern", or "add your flow in the middle"

Metadata

Metadata

Assignees

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