MCPcopy
hub / github.com/react-hook-form/react-hook-form / append

Function append

src/useFieldArray.ts:173–199  ·  view source on GitHub ↗
(
    value:
      | Partial<FieldArray<TFieldValues, TFieldArrayName>>
      | Partial<FieldArray<TFieldValues, TFieldArrayName>>[],
    options?: FieldArrayMethodProps,
  )

Source from the content-addressed store, hash-verified

171 );
172
173 const append = (
174 value:
175 | Partial<FieldArray<TFieldValues, TFieldArrayName>>
176 | Partial<FieldArray<TFieldValues, TFieldArrayName>>[],
177 options?: FieldArrayMethodProps,
178 ) => {
179 if (disabled) {
180 return;
181 }
182
183 const appendValue = convertToArrayPayload(cloneObject(value));
184 const updatedFieldArrayValues = appendAt(
185 control._getFieldArray(name),
186 appendValue,
187 );
188 control._names.focus = getFocusFieldName(
189 name,
190 updatedFieldArrayValues.length - 1,
191 options,
192 );
193 ids.current = appendAt(ids.current, appendValue.map(generateId));
194 updateValues(updatedFieldArrayValues);
195 setFields(updatedFieldArrayValues);
196 control._setFieldArray(name, updatedFieldArrayValues, appendAt, {
197 argA: fillEmptyArray(value),
198 });
199 };
200
201 const prepend = (
202 value:

Callers 15

FieldArrayFunction · 0.85
AppFunction · 0.85
ComponentFunction · 0.85
FormFunction · 0.85
ComponentFunction · 0.85
NestedFunction · 0.85
AppFunction · 0.85
ArrayFieldFunction · 0.85
ChildComponentFunction · 0.85
TestFunction · 0.85
ChildFunction · 0.85
FieldArrayFunction · 0.85

Calls 1

cloneObjectFunction · 0.85

Tested by 15

FieldArrayFunction · 0.68
AppFunction · 0.68
ComponentFunction · 0.68
FormFunction · 0.68
ComponentFunction · 0.68
NestedFunction · 0.68
AppFunction · 0.68
ArrayFieldFunction · 0.68
ChildComponentFunction · 0.68
TestFunction · 0.68
ChildFunction · 0.68
FieldArrayFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…