Skip to content

Commit

Permalink
fix: pass canManageFolderStructure as the canDrag cb dep (#3681)
Browse files Browse the repository at this point in the history
  • Loading branch information
adrians5j committed Nov 9, 2023
1 parent 6a0cac5 commit 511c4d9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
11 changes: 7 additions & 4 deletions packages/app-aco/src/components/FolderTree/List/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,13 @@ export const List: React.VFC<ListProps> = ({
setOpenFolderIds([ROOT_FOLDER, ...folderIds]);
};

const canDrag = useCallback((folderId: string) => {
const isRootFolder = folderId === ROOT_FOLDER;
return !isRootFolder && canManageFolderStructure(folderId);
}, []);
const canDrag = useCallback(
(folderId: string) => {
const isRootFolder = folderId === ROOT_FOLDER;
return !isRootFolder && canManageFolderStructure(folderId);
},
[canManageFolderStructure]
);

return (
<>
Expand Down
4 changes: 2 additions & 2 deletions packages/app-form-builder/src/components/Form/FormRender.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ const FormRender: React.FC<FbFormRenderComponentProps> = props => {
// Check if the form is a multi step.
const isMultiStepForm = formData.steps.length > 1;

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

// We need this check in case we deleted last step and at the same time we were previewing it.
const currentStep =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ const FormRender: React.FC<FormRenderProps> = props => {
setCurrentStepIndex(prevStep => (prevStep -= 1));
};

const isFirstStep = isMultiStepForm && currentStepIndex === 0;
const isLastStep = isMultiStepForm && currentStepIndex === formData.steps.length - 1;
const isFirstStep = currentStepIndex === 0;
const isLastStep = currentStepIndex === formData.steps.length - 1;

const currentStep =
formData.steps[currentStepIndex] === undefined
Expand Down Expand Up @@ -191,6 +191,7 @@ const FormRender: React.FC<FormRenderProps> = props => {
}
};
}

const formSubmission = await createFormSubmission({
props,
formSubmissionFieldValues,
Expand Down

0 comments on commit 511c4d9

Please sign in to comment.