@rainbow-oh/yee-c 0.4.2 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -420,6 +420,9 @@ var FormStore = class {
420
420
  } else {
421
421
  this.store = __spreadProps(__spreadValues({}, this.store), { [normalizedName]: value });
422
422
  }
423
+ if (value !== void 0) {
424
+ this.notifyWatchers(normalizedName);
425
+ }
423
426
  }
424
427
  }
425
428
  (_b = entity.onStoreChange) == null ? void 0 : _b.call(entity);
@@ -46,10 +46,12 @@ function useWatch(namePath, form) {
46
46
  const getWatchedValue = () => isWatchAll ? formInstance.getFieldsValue() : formInstance.getFieldValue(
47
47
  Array.isArray(namePath) ? namePath.join(".") : namePath
48
48
  );
49
- const unsubscribe = formInstance.subscribe(namePath, () => {
49
+ const update = () => {
50
50
  const newValue = getWatchedValue();
51
51
  setValue((prev) => prev === newValue ? prev : newValue);
52
- });
52
+ };
53
+ const unsubscribe = formInstance.subscribe(namePath, update);
54
+ update();
53
55
  return unsubscribe;
54
56
  }, [formInstance, namePath]);
55
57
  return value;
@@ -106,7 +106,6 @@ var TextArea = (0, import_react.forwardRef)(
106
106
  value,
107
107
  defaultValue
108
108
  });
109
- console.log("mergedValue: ", mergedValue, value);
110
109
  (0, import_react.useEffect)(() => {
111
110
  const ele = componentRef.current;
112
111
  if (ele && autoSize) {
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * @rainbow-oh/yee-c CSS Variables
3
3
  * Auto-generated, do not edit manually
4
- * Generated on 2026-07-01T03:21:30.989Z
4
+ * Generated on 2026-07-01T08:27:40.578Z
5
5
  */
6
6
 
7
7
  /* ========== color.blue.css ========== */
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * @rainbow-oh/yee-c CSS Variables
3
3
  * Auto-generated, do not edit manually
4
- * Generated on 2026-07-01T03:21:30.989Z
4
+ * Generated on 2026-07-01T08:27:40.578Z
5
5
  */
6
6
 
7
7
  /* ========== color.css ========== */
@@ -3,4 +3,4 @@ declare global {
3
3
  __yee_c_version__: string;
4
4
  }
5
5
  }
6
- export declare const version = "0.4.2";
6
+ export declare const version = "0.4.3";
@@ -22,7 +22,7 @@ __export(version_exports, {
22
22
  version: () => version
23
23
  });
24
24
  module.exports = __toCommonJS(version_exports);
25
- var version = "0.4.2";
25
+ var version = "0.4.3";
26
26
  if (typeof window !== "undefined") {
27
27
  window.__yee_c_version__ = version;
28
28
  }
@@ -445,6 +445,10 @@ export var FormStore = /*#__PURE__*/function () {
445
445
  } else {
446
446
  _this.store = _objectSpread(_objectSpread({}, _this.store), {}, _defineProperty({}, normalizedName, value));
447
447
  }
448
+ // When value is not undefined, notify watchers to trigger re-rendering of useWatch
449
+ if (value !== undefined) {
450
+ _this.notifyWatchers(normalizedName);
451
+ }
448
452
  }
449
453
  }
450
454
  (_entity$onStoreChange = entity.onStoreChange) === null || _entity$onStoreChange === void 0 || _entity$onStoreChange.call(entity);
@@ -20,12 +20,17 @@ function useWatch(namePath, form) {
20
20
  var getWatchedValue = function getWatchedValue() {
21
21
  return isWatchAll ? formInstance.getFieldsValue() : formInstance.getFieldValue(Array.isArray(namePath) ? namePath.join('.') : namePath);
22
22
  };
23
- var unsubscribe = formInstance.subscribe(namePath, function () {
23
+ var update = function update() {
24
24
  var newValue = getWatchedValue();
25
25
  setValue(function (prev) {
26
26
  return prev === newValue ? prev : newValue;
27
27
  });
28
- });
28
+ };
29
+ var unsubscribe = formInstance.subscribe(namePath, update);
30
+ // Re-read immediately after subscribing: the parent's useWatch captured its
31
+ // initial snapshot before child Form.Field wrote its initialValue, and the
32
+ // subscription may not yet exist when that write happens. This covers the gap.
33
+ update();
29
34
  return unsubscribe;
30
35
  }, [formInstance, namePath]);
31
36
  return value;
@@ -47,7 +47,6 @@ var TextArea = /*#__PURE__*/forwardRef(function (baseprops, ref) {
47
47
  _useMergedState2 = _slicedToArray(_useMergedState, 2),
48
48
  mergedValue = _useMergedState2[0],
49
49
  setMergedValue = _useMergedState2[1];
50
- console.log('mergedValue: ', mergedValue, value);
51
50
  useEffect(function () {
52
51
  var ele = componentRef.current;
53
52
  if (ele && autoSize) {
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * @rainbow-oh/yee-c CSS Variables
3
3
  * Auto-generated, do not edit manually
4
- * Generated on 2026-07-01T03:21:30.989Z
4
+ * Generated on 2026-07-01T08:27:40.578Z
5
5
  */
6
6
 
7
7
  /* ========== color.blue.css ========== */
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * @rainbow-oh/yee-c CSS Variables
3
3
  * Auto-generated, do not edit manually
4
- * Generated on 2026-07-01T03:21:30.989Z
4
+ * Generated on 2026-07-01T08:27:40.578Z
5
5
  */
6
6
 
7
7
  /* ========== color.css ========== */
@@ -3,4 +3,4 @@ declare global {
3
3
  __yee_c_version__: string;
4
4
  }
5
5
  }
6
- export declare const version = "0.4.2";
6
+ export declare const version = "0.4.3";
@@ -1,4 +1,4 @@
1
- export var version = "0.4.2";
1
+ export var version = "0.4.3";
2
2
  if (typeof window !== 'undefined') {
3
3
  window.__yee_c_version__ = version;
4
4
  }