Skip to content

Commit 1c5281e

Browse files
committed
[chore] Fix <SaveButton> _Dirty_ story
1 parent baba96f commit 1c5281e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/ra-ui-materialui/src/button/SaveButton.stories.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,14 @@ export const Basic = () => (
2626
);
2727

2828
const MakeFormChange = () => {
29-
const { setValue } = useFormContext();
29+
const {
30+
setValue,
31+
formState: { isReady },
32+
} = useFormContext();
3033
React.useEffect(() => {
34+
if (!isReady) return;
3135
setValue('name', 'test', { shouldDirty: true });
32-
}, [setValue]);
36+
}, [isReady, setValue]);
3337
return null;
3438
};
3539

0 commit comments

Comments
 (0)