Files
klz-cables.com/.pnpm-store/v10/files/44/001a3e555eadede5131ad39fa28e3e3d7a4d6efa5c631f44ab0ee2ade4dc8e1f905c4002341060c340af726aa5ce980aa67c4ae0d7f7baa01d5326ab9515fd
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

33 lines
1.8 KiB
Plaintext

import type { FormState } from 'payload';
/**
* If true, will accept all values from the server, overriding any current values in local state.
* Can also provide an options object for more granular control.
*/
export type AcceptValues = {
/**
* When `false`, will accept the values from the server _UNLESS_ the value has been modified locally since the request was made.
* This is useful for autosave, for example, where hooks may have modified the field's value on the server while you were still making changes.
* @default undefined
*/
overrideLocalChanges?: boolean;
} | boolean;
type Args = {
acceptValues?: AcceptValues;
currentState?: FormState;
incomingState: FormState;
};
/**
* This function receives form state from the server and intelligently merges it into the client state.
* The server contains extra properties that the client may not have, e.g. custom components and error states.
* We typically do not want to merge properties that rely on user input, however, such as values, unless explicitly requested.
* Doing this would cause the client to lose any local changes to those fields.
*
* Note: Local state is the source of truth, not the new server state that is getting merged in. This is critical for array row
* manipulation specifically, where the user may have added, removed, or reordered rows while a request was pending and is now stale.
*
* This function applies some defaults, as well as cleans up the server response in preparation for the client.
* e.g. it will set `valid` and `passesCondition` to true if undefined, and remove `addedByServer` from the response.
*/
export declare const mergeServerFormState: ({ acceptValues, currentState, incomingState, }: Args) => FormState;
export {};
//# sourceMappingURL=mergeServerFormState.d.ts.map