@conform-to/react
Advanced tools
| import { type Serialize, type SubmissionResult, serialize } from '@conform-to/dom/future'; | ||
| import { useEffect } from 'react'; | ||
| import type { FormContext, DefaultMetadata, IntentDispatcher, FormMetadata, Fieldset, FormOptions, FieldName, FieldMetadata, Control, Selector, UseFormDataOptions, ValidateHandler, ErrorHandler, SubmitHandler, FormState, FormRef } from './types'; | ||
| export declare const INITIAL_KEY = "INITIAL_KEY"; | ||
| export declare const FormConfig: import("react").Context<{ | ||
@@ -5,0 +6,0 @@ intentName: string; |
@@ -15,2 +15,3 @@ 'use client'; | ||
| var INITIAL_KEY = 'INITIAL_KEY'; | ||
| var FormConfig = /*#__PURE__*/react.createContext({ | ||
@@ -55,3 +56,3 @@ intentName: future.DEFAULT_INTENT_NAME, | ||
| var [state$1, setState] = react.useState(() => { | ||
| var state$1 = state.initializeState(); | ||
| var state$1 = state.initializeState(INITIAL_KEY); | ||
| if (lastResult) { | ||
@@ -751,2 +752,3 @@ state$1 = state.updateState(state$1, _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, lastResult), {}, { | ||
| exports.FormProvider = FormProvider; | ||
| exports.INITIAL_KEY = INITIAL_KEY; | ||
| exports.useConform = useConform; | ||
@@ -753,0 +755,0 @@ exports.useControl = useControl; |
@@ -11,2 +11,3 @@ 'use client'; | ||
| var INITIAL_KEY = 'INITIAL_KEY'; | ||
| var FormConfig = /*#__PURE__*/createContext({ | ||
@@ -51,3 +52,3 @@ intentName: DEFAULT_INTENT_NAME, | ||
| var [state, setState] = useState(() => { | ||
| var state = initializeState(); | ||
| var state = initializeState(INITIAL_KEY); | ||
| if (lastResult) { | ||
@@ -744,2 +745,2 @@ state = updateState(state, _objectSpread2(_objectSpread2({}, lastResult), {}, { | ||
| export { Form, FormConfig, FormProvider, useConform, useControl, useField, useForm, useFormContext, useFormData, useFormMetadata, useIntent, useLatest, useSafeLayoutEffect }; | ||
| export { Form, FormConfig, FormProvider, INITIAL_KEY, useConform, useControl, useField, useForm, useFormContext, useFormData, useFormMetadata, useIntent, useLatest, useSafeLayoutEffect }; |
| import { type ValidationAttributes, type Serialize } from '@conform-to/dom/future'; | ||
| import type { DefaultMetadata, FieldMetadata, FieldName, Fieldset, FormContext, FormMetadata, FormState, FormAction, UnknownIntent, ActionHandler } from './types'; | ||
| export declare function initializeState<ErrorShape>(): FormState<ErrorShape>; | ||
| export declare function initializeState<ErrorShape>(resetKey?: string): FormState<ErrorShape>; | ||
| /** | ||
@@ -5,0 +5,0 @@ * Updates form state based on action type: |
@@ -9,5 +9,5 @@ 'use strict'; | ||
| function initializeState() { | ||
| function initializeState(resetKey) { | ||
| return { | ||
| resetKey: util.generateUniqueKey(), | ||
| resetKey: resetKey !== null && resetKey !== void 0 ? resetKey : util.generateUniqueKey(), | ||
| listKeys: {}, | ||
@@ -14,0 +14,0 @@ clientIntendedValue: null, |
@@ -5,5 +5,5 @@ import { objectSpread2 as _objectSpread2 } from '../_virtual/_rollupPluginBabelHelpers.mjs'; | ||
| function initializeState() { | ||
| function initializeState(resetKey) { | ||
| return { | ||
| resetKey: generateUniqueKey(), | ||
| resetKey: resetKey !== null && resetKey !== void 0 ? resetKey : generateUniqueKey(), | ||
| listKeys: {}, | ||
@@ -10,0 +10,0 @@ clientIntendedValue: null, |
@@ -277,3 +277,3 @@ import type { FormError, FormValue, SubmissionResult, ValidationAttributes } from '@conform-to/dom/future'; | ||
| valid: boolean; | ||
| /** @deprecated Use `.valid` instead. This was not an intentionl breaking change and would be removed in the next minor version soon */ | ||
| /** @deprecated Use `.valid` instead. This was not an intentional breaking change and would be removed in the next minor version soon */ | ||
| invalid: boolean; | ||
@@ -297,3 +297,3 @@ /** Form-level validation errors, if any exist. */ | ||
| /** Method to get a fieldset object for nested object fields. */ | ||
| getFieldset<FieldShape>(name: FieldName<FieldShape>): Fieldset<[ | ||
| getFieldset<FieldShape>(name?: FieldName<FieldShape>): Fieldset<[ | ||
| FieldShape | ||
@@ -300,0 +300,0 @@ ] extends [Record<string, unknown> | null | undefined] ? FieldShape : unknown, Metadata>; |
+2
-2
@@ -6,3 +6,3 @@ { | ||
| "license": "MIT", | ||
| "version": "1.10.0", | ||
| "version": "1.10.1", | ||
| "main": "./dist/index.js", | ||
@@ -45,3 +45,3 @@ "module": "./dist/index.mjs", | ||
| "dependencies": { | ||
| "@conform-to/dom": "1.10.0" | ||
| "@conform-to/dom": "1.10.1" | ||
| }, | ||
@@ -48,0 +48,0 @@ "devDependencies": { |
+1
-1
@@ -10,3 +10,3 @@ ``` | ||
| Version 1.10.0 / License MIT / Copyright (c) 2025 Edmund Hung | ||
| Version 1.10.1 / License MIT / Copyright (c) 2025 Edmund Hung | ||
@@ -13,0 +13,0 @@ Progressively enhance HTML forms with React. Build resilient, type-safe forms with no hassle using web standards. |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
282940
0.12%6850
0.06%+ Added
- Removed
Updated