Files
klz-cables.com/.pnpm-store/v10/files/cd/795d277d8caf32eb71c6e3585aff5422f3e5ecf711e856a042a29d9e0d63de5ff7a521d9d462fab01152ac65b85910b355caa7d01efe1caf7f5f55a501fcb5
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

43 lines
2.4 KiB
Plaintext

import type { FieldState, Validate } from 'payload';
export type Options = {
disableFormData?: boolean;
hasRows?: boolean;
/**
* If `path` is provided to this hook, it will be used outright. This is useful when calling this hook directly within a custom component.
* Otherwise, the field will attempt to get the path from the `FieldPathContext` via the `useFieldPath` hook.
* If still not found, the `potentiallyStalePath` arg will be used. See the note below about why this is important.
*/
path?: string;
/**
* Custom server components receive a static `path` prop at render-time, leading to temporarily stale paths when re-ordering rows in form state.
* This is because when manipulating rows, field paths change in form state, but the prop remains the same until the component is re-rendered on the server.
* This causes the component to temporarily point to the wrong field in form state until the server responds with a freshly rendered component.
* To prevent this, fields are wrapped with a `FieldPathContext` which is guaranteed to be up-to-date.
* The `path` prop that Payload's default fields receive, then, are sent into this hook as the `potentiallyStalePath` arg.
* This ensures that:
* 1. Custom components that use this hook directly will still respect the `path` prop as top priority.
* 2. Custom server components that blindly spread their props into default Payload fields still prefer the dynamic path from context.
* 3. Components that render default Payload fields directly do not require a `FieldPathProvider`, e.g. the email field in the account view.
*/
potentiallyStalePath?: string;
/**
* Client-side validation function fired when the form is submitted.
*/
validate?: Validate;
};
export type FieldType<T> = {
disabled: boolean;
formInitializing: boolean;
formProcessing: boolean;
formSubmitted: boolean;
initialValue?: T;
path: string;
/**
* @deprecated - readOnly is no longer returned from useField. Remove this in 4.0.
*/
readOnly?: boolean;
setValue: (val: unknown, disableModifyingForm?: boolean) => void;
showError: boolean;
value: T;
} & Pick<FieldState, 'blocksFilterOptions' | 'customComponents' | 'errorMessage' | 'errorPaths' | 'filterOptions' | 'rows' | 'selectFilterOptions' | 'valid'>;
//# sourceMappingURL=types.d.ts.map