MCPcopy Create free account
hub / github.com/dailydotdev/apps / updateStep

Function updateStep

packages/shared/src/hooks/useChecklist.spec.tsx:9–30  ·  view source on GitHub ↗
(
  steps: ChecklistStepType[],
  index: number,
  update: Omit<Partial<ChecklistStepType>, 'action'> & {
    action: Partial<ChecklistStepType['action']>;
  },
)

Source from the content-addressed store, hash-verified

7import type { ChecklistStepType } from '../lib/checklist';
8
9export const updateStep = (
10 steps: ChecklistStepType[],
11 index: number,
12 update: Omit<Partial<ChecklistStepType>, 'action'> & {
13 action: Partial<ChecklistStepType['action']>;
14 },
15): ChecklistStepType[] => {
16 const step = steps[index];
17 const updatedStep = {
18 ...step,
19 ...update,
20 action: {
21 ...step.action,
22 ...update.action,
23 },
24 };
25
26 const updatedSteps = [...steps];
27 updatedSteps.splice(index, 1, updatedStep);
28
29 return updatedSteps;
30};
31
32export const defaultSteps = [
33 {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected