Skip to content

Commit 511c4d9

Browse files
authored
fix: pass canManageFolderStructure as the canDrag cb dep (#3681)
1 parent 6a0cac5 commit 511c4d9

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

packages/app-aco/src/components/FolderTree/List/index.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,13 @@ export const List: React.VFC<ListProps> = ({
9999
setOpenFolderIds([ROOT_FOLDER, ...folderIds]);
100100
};
101101

102-
const canDrag = useCallback((folderId: string) => {
103-
const isRootFolder = folderId === ROOT_FOLDER;
104-
return !isRootFolder && canManageFolderStructure(folderId);
105-
}, []);
102+
const canDrag = useCallback(
103+
(folderId: string) => {
104+
const isRootFolder = folderId === ROOT_FOLDER;
105+
return !isRootFolder && canManageFolderStructure(folderId);
106+
},
107+
[canManageFolderStructure]
108+
);
106109

107110
return (
108111
<>

packages/app-form-builder/src/components/Form/FormRender.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ const FormRender: React.FC<FbFormRenderComponentProps> = props => {
8989
// Check if the form is a multi step.
9090
const isMultiStepForm = formData.steps.length > 1;
9191

92-
const isFirstStep = isMultiStepForm && currentStepIndex === 0;
93-
const isLastStep = !isMultiStepForm || currentStepIndex === steps.length - 1;
92+
const isFirstStep = currentStepIndex === 0;
93+
const isLastStep = currentStepIndex === steps.length - 1;
9494

9595
// We need this check in case we deleted last step and at the same time we were previewing it.
9696
const currentStep =

packages/app-page-builder-elements/src/renderers/form/FormRender.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ const FormRender: React.FC<FormRenderProps> = props => {
4949
setCurrentStepIndex(prevStep => (prevStep -= 1));
5050
};
5151

52-
const isFirstStep = isMultiStepForm && currentStepIndex === 0;
53-
const isLastStep = isMultiStepForm && currentStepIndex === formData.steps.length - 1;
52+
const isFirstStep = currentStepIndex === 0;
53+
const isLastStep = currentStepIndex === formData.steps.length - 1;
5454

5555
const currentStep =
5656
formData.steps[currentStepIndex] === undefined
@@ -191,6 +191,7 @@ const FormRender: React.FC<FormRenderProps> = props => {
191191
}
192192
};
193193
}
194+
194195
const formSubmission = await createFormSubmission({
195196
props,
196197
formSubmissionFieldValues,

0 commit comments

Comments
 (0)