Skip to content

Commit b75b788

Browse files
committed
chore(release): v1.6.3
1 parent fc08220 commit b75b788

3 files changed

Lines changed: 15 additions & 3 deletions

File tree

docs/demos/dymic/_watch.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export default function App() {
2929
</div>
3030
));
3131

32-
const subscribeFirstValue = useWatch(
32+
useWatch(
3333
({ model }) => [model.fieldsDymic[0], model.fieldsDymic[1]],
3434
(value) => {
3535
alert(JSON.stringify(value));

src/use/useFormExtraApi.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,12 @@ export const useFormExtraApi = <T extends DefaultRecord>({
3232
}) => {
3333
// Simplified forceUpdate implementation
3434
const [, setTick] = useState(0);
35-
const forceUpdate = useCallback(() => setTick((prev) => prev + 1), []);
35+
const forceUpdate = useCallback(() => {
36+
// Trigger subscribe and watch notifications for dynamic array updates
37+
contextProps.observerFactory.subscribeManager.notify();
38+
contextProps.observerFactory.watchManager.notify();
39+
setTick((prev) => prev + 1);
40+
}, [contextProps.observerFactory]);
3641

3742
const { model } = contextProps;
3843

src/use/useFormItemContentController.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,14 @@ export function useFormItemContentController(
5858

5959
// Simplified forceUpdate implementation
6060
const [, setTick] = useState(0);
61-
const forceUpdate = useCallback(() => setTick((prev) => prev + 1), []);
61+
const forceUpdate = useCallback(() => {
62+
// Trigger subscribe and watch notifications for form item updates
63+
if (contextProps?.observerFactory) {
64+
contextProps.observerFactory.subscribeManager.notify();
65+
contextProps.observerFactory.watchManager.notify();
66+
}
67+
setTick((prev) => prev + 1);
68+
}, [contextProps?.observerFactory]);
6269

6370
// Use shared model instead of independent modelValue
6471
const sharedModel = contextProps?.model;

0 commit comments

Comments
 (0)