Skip to content

Commit 6467209

Browse files
committed
fix(target): adjust form reset when not success
1 parent 63ed3c7 commit 6467209

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ Introduce `UCDataStoreMode` setting. It allows to to set it to `READ_WRITE` (def
1010
For instance, it's very useful to set it to `READ` when planning a migration with different DB enfines.
1111
In addition to that, `NONE` is convenient to prevent all reads and writes when there is an issue.
1212

13+
Fix an issue where the form would reset even when not success on the react target.
14+
1315
See all the changes here : https://github.com/c100k/libmodulor/compare/v0.27.0...master
1416

1517
## v0.27.0 (2026-02-09)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
import { type ReactElement } from 'react';
2-
import type { UCInput, UCOPIBase } from '../../uc/index.js';
2+
import { type UCInput, type UCOPIBase } from '../../uc/index.js';
33
import type { UCFormProps } from '../lib/react/form.js';
44
export declare function UCForm<I extends UCInput | undefined = undefined, OPI0 extends UCOPIBase | undefined = undefined, OPI1 extends UCOPIBase | undefined = undefined>({ clearAfterExec, disabled, execState, onSubmit: onSubmitBase, uc, }: UCFormProps<I, OPI0, OPI1>): ReactElement;

dist/esm/target/react-web-pure/UCForm.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
22
import { useRef } from 'react';
3+
import { UCExecRes } from '../../uc/index.js';
34
import { useStyleContext } from '../lib/react/StyleContextProvider.js';
45
import { UCFormField } from './UCFormField.js';
56
import { UCFormSubmitControl } from './UCFormSubmitControl.js';
@@ -8,8 +9,8 @@ export function UCForm({ clearAfterExec, disabled, execState, onSubmit: onSubmit
89
const formRef = useRef(null);
910
const onSubmit = async (e) => {
1011
e.preventDefault();
11-
const succeeded = await onSubmitBase();
12-
if (succeeded && clearAfterExec) {
12+
const res = await onSubmitBase();
13+
if (res === UCExecRes.SUCCEEDED && clearAfterExec) {
1314
formRef.current?.reset();
1415
}
1516
};

0 commit comments

Comments
 (0)