Deep-copy cached state

When cached data (e.g., `row.settings`) is used to initialize mutable UI state (forms, editors, draft objects), do not pass cached object references directly. Always deep-clone cached objects on entry to editable state to prevent unintended cache mutations and ensure copied/duplicated initialization is isolated.

copy reviewer prompt

Prompt

Reviewer Prompt

When cached data (e.g., row.settings) is used to initialize mutable UI state (forms, editors, draft objects), do not pass cached object references directly. Always deep-clone cached objects on entry to editable state to prevent unintended cache mutations and ensure copied/duplicated initialization is isolated.

Example pattern:

const settings = currentRow.settings
  ? structuredClone(currentRow.settings)
  : undefined;

// use `settings` as initial/editable state
const initialValues = {
  ...,
  settings,
};

If settings is nested, prefer structuredClone (or an equivalent deep-clone) over shallow spreads to guarantee full isolation.

Source discussions