@formality-ui/react 0.3.0 → 0.3.1

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.
package/dist/index.js CHANGED
@@ -162,8 +162,15 @@ function Form({
162
162
  return result;
163
163
  }, [providerConfig.inputs, formConfig.inputs]);
164
164
  const defaultValues = useMemo(() => {
165
- const resolved = resolveAllInitialValues(config, mergedInputs, record ?? {});
166
- const baseline = { ...record ?? {}, ...resolved };
165
+ const resolved = resolveAllInitialValues(
166
+ config,
167
+ mergedInputs,
168
+ record ?? {}
169
+ );
170
+ const baseline = {
171
+ ...record ?? {},
172
+ ...resolved
173
+ };
167
174
  for (const fieldName of Object.keys(config)) {
168
175
  if (!(fieldName in baseline)) baseline[fieldName] = void 0;
169
176
  }
@@ -201,11 +208,6 @@ function Form({
201
208
  invertedSubscriptions.current.set(target, /* @__PURE__ */ new Set());
202
209
  }
203
210
  invertedSubscriptions.current.get(target).add(subscriber);
204
- if (process.env.NODE_ENV !== "production") {
205
- console.warn(
206
- `[Formality Subscription] "${subscriber}" added to watch "${target}"`
207
- );
208
- }
209
211
  const setter = watcherSetters.current.get(target);
210
212
  if (setter) {
211
213
  setter((prev) => ({ ...prev, [subscriber]: true }));
@@ -218,20 +220,7 @@ function Form({
218
220
  }, []);
219
221
  const removeSubscription = useCallback(
220
222
  (target, subscriber) => {
221
- const subscribers = invertedSubscriptions.current.get(target);
222
- const subscriptionExists = subscribers?.has(subscriber) ?? false;
223
223
  invertedSubscriptions.current.get(target)?.delete(subscriber);
224
- if (process.env.NODE_ENV !== "production") {
225
- if (subscriptionExists) {
226
- console.warn(
227
- `[Formality Subscription] "${subscriber}" removed from watching "${target}"`
228
- );
229
- } else {
230
- console.warn(
231
- `[Formality Subscription] WARNING: Double-cleanup attempt - "${subscriber}" was not watching "${target}"`
232
- );
233
- }
234
- }
235
224
  const setter = watcherSetters.current.get(target);
236
225
  if (setter) {
237
226
  setter((prev) => {
@@ -918,20 +907,10 @@ function useSubscriptions(fieldName, subscriptions) {
918
907
  runSubscriptionsRef.current.set(currentRunId, [...subscriptions]);
919
908
  subscriptions.forEach((target) => {
920
909
  addSubscription(target, fieldName);
921
- if (process.env.NODE_ENV !== "production") {
922
- console.warn(
923
- `[Formality Subscription] Run ${currentRunId}: "${fieldName}" subscribing to "${target}"`
924
- );
925
- }
926
910
  });
927
911
  return () => {
928
912
  const thisRunSubscriptions = runSubscriptionsRef.current.get(currentRunId);
929
913
  if (thisRunSubscriptions) {
930
- if (process.env.NODE_ENV !== "production") {
931
- console.warn(
932
- `[Formality Subscription] Run ${currentRunId}: "${fieldName}" cleaning up [${thisRunSubscriptions.join(", ")}]`
933
- );
934
- }
935
914
  [...thisRunSubscriptions].reverse().forEach((target) => {
936
915
  removeSubscription(target, fieldName);
937
916
  });