feat: implement updateListTextFieldLabel

This commit is contained in:
karishmas6
2024-09-13 23:26:24 +05:30
parent f0ec5dbb67
commit e4ed54a7c0

View File

@@ -102,6 +102,26 @@ export const BrowserStepsProvider: React.FC<{ children: React.ReactNode }> = ({
);
};
const updateListTextFieldLabel = (listId: number, fieldKey: string, newLabel: string) => {
setBrowserSteps(prevSteps =>
prevSteps.map(step => {
if (step.type === 'list' && step.id === listId) {
return {
...step,
fields: {
...step.fields,
[fieldKey]: {
...step.fields[fieldKey],
label: newLabel
}
}
};
}
return step;
})
);
};
return (
<BrowserStepsContext.Provider value={{
browserSteps,