Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## [1.6.3](https://github.com/easy-form/react-form-simple/compare/v1.6.2...v1.6.3) (2025-10-24)

### Bug Fixes

- fix Array changes cannot be observed ([b75b788](https://github.com/easy-form/react-form-simple/commit/b75b7886756391ca9033e4473e52c31e69d4c6f7))

## [1.6.2](https://github.com/easy-form/react-form-simple/compare/v1.5.2...v1.6.2) (2025-07-21)

### Bug Fixes
Expand Down
2 changes: 1 addition & 1 deletion docs/demos/dymic/_watch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default function App() {
</div>
));

const subscribeFirstValue = useWatch(
useWatch(
({ model }) => [model.fieldsDymic[0], model.fieldsDymic[1]],
(value) => {
alert(JSON.stringify(value));
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-form-simple",
"version": "1.6.2",
"version": "1.6.3",
"description": "A form library for quickly controlling react form input",
"keywords": [
"react",
Expand Down
7 changes: 6 additions & 1 deletion src/use/useFormExtraApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ export const useFormExtraApi = <T extends DefaultRecord>({
}) => {
// Simplified forceUpdate implementation
const [, setTick] = useState(0);
const forceUpdate = useCallback(() => setTick((prev) => prev + 1), []);
const forceUpdate = useCallback(() => {
// Trigger subscribe and watch notifications for dynamic array updates
contextProps.observerFactory.subscribeManager.notify();
contextProps.observerFactory.watchManager.notify();
setTick((prev) => prev + 1);
}, [contextProps.observerFactory]);

const { model } = contextProps;

Expand Down
9 changes: 8 additions & 1 deletion src/use/useFormItemContentController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,14 @@ export function useFormItemContentController(

// Simplified forceUpdate implementation
const [, setTick] = useState(0);
const forceUpdate = useCallback(() => setTick((prev) => prev + 1), []);
const forceUpdate = useCallback(() => {
// Trigger subscribe and watch notifications for form item updates
if (contextProps?.observerFactory) {
contextProps.observerFactory.subscribeManager.notify();
contextProps.observerFactory.watchManager.notify();
}
setTick((prev) => prev + 1);
}, [contextProps?.observerFactory]);

// Use shared model instead of independent modelValue
const sharedModel = contextProps?.model;
Expand Down
Loading