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

@tanstack/form-core

Package Overview
Dependencies
Maintainers
2
Versions
103
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tanstack/form-core - npm Package Compare versions

Comparing version 0.34.4 to 0.35.0

8

dist/esm/FormApi.d.ts

@@ -285,4 +285,10 @@ import { Store } from '@tanstack/store';

* Resets the form state to the default values.
* If values are provided, the form will be reset to those values instead and the default values will be updated.
*
* @param values - Optional values to reset the form to.
* @param opts - Optional options to control the reset behavior.
*/
reset: () => void;
reset: (values?: TFormData, opts?: {
keepDefaultValues?: boolean;
}) => void;
/**

@@ -289,0 +295,0 @@ * Validates all fields in the form using the correct handlers for a given validation type.

10

dist/esm/FormApi.js

@@ -84,5 +84,11 @@ import { Store } from "@tanstack/store";

};
this.reset = () => {
this.reset = (values, opts2) => {
const { fieldMeta: currentFieldMeta } = this.state;
const fieldMeta = this.resetFieldMeta(currentFieldMeta);
if (values && !(opts2 == null ? void 0 : opts2.keepDefaultValues)) {
this.options = {
...this.options,
defaultValues: values
};
}
this.store.setState(

@@ -93,3 +99,3 @@ () => {

...this.options.defaultState,
values: this.options.defaultValues ?? ((_a2 = this.options.defaultState) == null ? void 0 : _a2.values),
values: values ?? this.options.defaultValues ?? ((_a2 = this.options.defaultState) == null ? void 0 : _a2.values),
fieldMeta

@@ -96,0 +102,0 @@ });

{
"name": "@tanstack/form-core",
"version": "0.34.4",
"version": "0.35.0",
"description": "Powerful, type-safe, framework agnostic forms.",

@@ -5,0 +5,0 @@ "author": "tannerlinsley",

@@ -575,10 +575,25 @@ import { Store } from '@tanstack/store'

* Resets the form state to the default values.
* If values are provided, the form will be reset to those values instead and the default values will be updated.
*
* @param values - Optional values to reset the form to.
* @param opts - Optional options to control the reset behavior.
*/
reset = () => {
reset = (values?: TFormData, opts?: { keepDefaultValues?: boolean }) => {
const { fieldMeta: currentFieldMeta } = this.state
const fieldMeta = this.resetFieldMeta(currentFieldMeta)
if (values && !opts?.keepDefaultValues) {
this.options = {
...this.options,
defaultValues: values,
}
}
this.store.setState(() =>
getDefaultFormState({
...(this.options.defaultState as any),
values: this.options.defaultValues ?? this.options.defaultState?.values,
values:
values ??
this.options.defaultValues ??
this.options.defaultState?.values,
fieldMeta,

@@ -585,0 +600,0 @@ }),

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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