Skip to content

Commit

Permalink
Run propagation effect when isDirty changes
Browse files Browse the repository at this point in the history
  • Loading branch information
stokesman committed May 29, 2022
1 parent 8952d45 commit 32eb218
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions packages/components/src/input-control/reducer/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,17 +211,14 @@ export function useInputControlStateReducer(
currentValueProp.current = initialState.value;
} );
useLayoutEffect( () => {
if (
state.value !== currentValueProp.current &&
! currentState.current.isDirty
) {
if ( state.value !== currentValueProp.current && ! state.isDirty ) {
onChangeHandler( state.value ?? '', {
event: currentState.current._event as
| ChangeEvent< HTMLInputElement >
| PointerEvent< HTMLInputElement >,
} );
}
}, [ state.value ] );
}, [ state.value, state.isDirty ] );
useLayoutEffect( () => {
if (
initialState.value !== currentState.current.value &&
Expand Down

0 comments on commit 32eb218

Please sign in to comment.