Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

uniforms

Package Overview
Dependencies
Maintainers
1
Versions
190
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

uniforms - npm Package Compare versions

Comparing version 3.6.1 to 3.6.2

3

cjs/QuickForm.d.ts
import React, { ComponentType } from 'react';
import { BaseForm, BaseFormProps, BaseFormState } from './BaseForm';
export declare type QuickFormProps<Model> = BaseFormProps<Model> & {
/**
* @deprecated
*/
autoField?: ComponentType<{

@@ -5,0 +8,0 @@ name: string;

22

cjs/useField.js

@@ -27,2 +27,5 @@ "use strict";

const context = useForm_1.useForm();
const usesInitialValue = (options === null || options === void 0 ? void 0 : options.initialValue) !== false;
// eslint-disable-next-line react-hooks/rules-of-hooks
const onChangeCalled = usesInitialValue ? react_1.useRef(false) : { current: false };
const name = joinName_1.joinName((options === null || options === void 0 ? void 0 : options.absoluteName) ? '' : context.name, fieldName);

@@ -45,2 +48,3 @@ const state = mapValues_1.default(context.state, (prev, key) => {

const onChange = react_1.useCallback((value, key = name) => {
onChangeCalled.current = true;
context.onChange(key, value);

@@ -53,10 +57,12 @@ },

let value = (_a = props.value) !== null && _a !== void 0 ? _a : valueFromModel;
if (value === undefined) {
value = context.schema.getInitialValue(name, props);
initialValue = value;
}
else if (props.value !== undefined && props.value !== valueFromModel) {
initialValue = props.value;
}
if ((options === null || options === void 0 ? void 0 : options.initialValue) !== false) {
if (usesInitialValue) {
if (!onChangeCalled.current) {
if (value === undefined) {
value = context.schema.getInitialValue(name, props);
initialValue = value;
}
else if (props.value !== undefined && props.value !== valueFromModel) {
initialValue = props.value;
}
}
// eslint-disable-next-line react-hooks/rules-of-hooks

@@ -63,0 +69,0 @@ react_1.useEffect(() => {

import React, { ComponentType } from 'react';
import { BaseForm, BaseFormProps, BaseFormState } from './BaseForm';
export declare type QuickFormProps<Model> = BaseFormProps<Model> & {
/**
* @deprecated
*/
autoField?: ComponentType<{

@@ -5,0 +8,0 @@ name: string;

import get from 'lodash/get';
import mapValues from 'lodash/mapValues';
import { useCallback, useEffect, useMemo } from 'react';
import { useCallback, useEffect, useMemo, useRef } from 'react';
import { joinName } from './joinName';

@@ -23,2 +23,5 @@ import { useForm } from './useForm';

const context = useForm();
const usesInitialValue = (options === null || options === void 0 ? void 0 : options.initialValue) !== false;
// eslint-disable-next-line react-hooks/rules-of-hooks
const onChangeCalled = usesInitialValue ? useRef(false) : { current: false };
const name = joinName((options === null || options === void 0 ? void 0 : options.absoluteName) ? '' : context.name, fieldName);

@@ -41,2 +44,3 @@ const state = mapValues(context.state, (prev, key) => {

const onChange = useCallback((value, key = name) => {
onChangeCalled.current = true;
context.onChange(key, value);

@@ -49,10 +53,12 @@ },

let value = (_a = props.value) !== null && _a !== void 0 ? _a : valueFromModel;
if (value === undefined) {
value = context.schema.getInitialValue(name, props);
initialValue = value;
}
else if (props.value !== undefined && props.value !== valueFromModel) {
initialValue = props.value;
}
if ((options === null || options === void 0 ? void 0 : options.initialValue) !== false) {
if (usesInitialValue) {
if (!onChangeCalled.current) {
if (value === undefined) {
value = context.schema.getInitialValue(name, props);
initialValue = value;
}
else if (props.value !== undefined && props.value !== valueFromModel) {
initialValue = props.value;
}
}
// eslint-disable-next-line react-hooks/rules-of-hooks

@@ -59,0 +65,0 @@ useEffect(() => {

{
"name": "uniforms",
"version": "3.6.1",
"version": "3.6.2",
"license": "MIT",

@@ -44,3 +44,3 @@ "main": "./cjs/index.js",

},
"gitHead": "a36891aa6aa9bb10c40bf5709085fbe82ac4ae92"
"gitHead": "36b3671537cf11e7610b9ca8b40f0bbaa508b8e1"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc