Skip to content

Commit acdb746

Browse files
fix: validation bypass when updating block
1 parent 5b2bfd0 commit acdb746

File tree

4 files changed

+23
-10
lines changed

4 files changed

+23
-10
lines changed

frontend/public/locales/en/translation.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@
116116
"select_category": "Select a flow",
117117
"logout_failed": "Something went wrong during logout",
118118
"duplicate_labels_not_allowed": "Duplicate labels are not allowed",
119-
"duplicate_block_error": "Something went wrong while duplicating block"
119+
"duplicate_block_error": "Something went wrong while duplicating block",
120+
"missing_fields_error": "Please make sure that all required fields are filled"
120121
},
121122
"menu": {
122123
"terms": "Terms of Use",

frontend/public/locales/fr/translation.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@
116116
"select_category": "Sélectionner une catégorie",
117117
"logout_failed": "Une erreur s'est produite lors de la déconnexion",
118118
"duplicate_labels_not_allowed": "Les étiquettes en double ne sont pas autorisées",
119-
"duplicate_block_error": "Une erreur est survenue lors de la duplication du bloc"
119+
"duplicate_block_error": "Une erreur est survenue lors de la duplication du bloc",
120+
"missing_fields_error": "Veuillez vous assurer que tous les champs sont remplis correctement"
120121
},
121122
"menu": {
122123
"terms": "Conditions d'utilisation",

frontend/src/app-components/tabs/TabPanel.tsx

+12-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright © 2024 Hexastack. All rights reserved.
2+
* Copyright © 2025 Hexastack. All rights reserved.
33
*
44
* Licensed under the GNU Affero General Public License v3.0 (AGPLv3) with the following additional terms:
55
* 1. The name "Hexabot" is a trademark of Hexastack. You may not use this name in derivative works without express written permission.
@@ -24,16 +24,21 @@ export function TabPanel(props: TabPanelProps & GridProps) {
2424
item
2525
xs
2626
role="tabpanel"
27-
hidden={value !== index}
2827
id={`vertical-tabpanel-${index}`}
2928
aria-labelledby={`vertical-tab-${index}`}
29+
sx={{
30+
display: "block",
31+
visibility: value === index ? "visible" : "hidden",
32+
height: value === index ? "auto" : 0,
33+
overflow: "hidden",
34+
position: value === index ? "relative" : "absolute",
35+
...sx,
36+
}}
3037
{...other}
3138
>
32-
{value === index ? (
33-
<Grid container sx={{ flexDirection: "column", ...sx }}>
34-
{children}
35-
</Grid>
36-
) : null}
39+
<Grid container sx={{ flexDirection: "column" }}>
40+
{children}
41+
</Grid>
3742
</Grid>
3843
);
3944
}

frontend/src/components/visual-editor/BlockEditForm.tsx

+7-1
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ export const BlockEditForm: FC<ComponentFormProps<IBlock>> = ({
100100
updateBlock({ id: block.id, params });
101101
}
102102
};
103+
const onSubmitError = () => {
104+
toast.error(t("message.missing_fields_error"));
105+
};
103106

104107
useEffect(() => {
105108
if (block) {
@@ -110,7 +113,10 @@ export const BlockEditForm: FC<ComponentFormProps<IBlock>> = ({
110113
}, [block, reset]);
111114

112115
return (
113-
<Wrapper onSubmit={handleSubmit(onSubmitForm)} {...WrapperProps}>
116+
<Wrapper
117+
onSubmit={handleSubmit(onSubmitForm, onSubmitError)}
118+
{...WrapperProps}
119+
>
114120
<BlockFormProvider methods={methods} block={block || undefined}>
115121
<ContentContainer>
116122
<ContentItem display="flex" gap={5}>

0 commit comments

Comments
 (0)