diff --git a/src/components/EditorHeader/SideSheet/Sidesheet.jsx b/src/components/EditorHeader/SideSheet/Sidesheet.jsx index c0221e7e0..69fa6cff3 100644 --- a/src/components/EditorHeader/SideSheet/Sidesheet.jsx +++ b/src/components/EditorHeader/SideSheet/Sidesheet.jsx @@ -17,7 +17,7 @@ export default function Sidesheet({ type, title, setTitle, onClose }) { case SIDESHEET.VERSIONS: return t("versions"); default: - break; + return ""; } } @@ -36,7 +36,7 @@ export default function Sidesheet({ type, title, setTitle, onClose }) { /> ); default: - break; + return null; } } diff --git a/src/components/EditorSidePanel/TypesTab/TypeInfo.jsx b/src/components/EditorSidePanel/TypesTab/TypeInfo.jsx index cfbe75c29..e71a265d6 100644 --- a/src/components/EditorSidePanel/TypesTab/TypeInfo.jsx +++ b/src/components/EditorSidePanel/TypesTab/TypeInfo.jsx @@ -23,7 +23,6 @@ export default function TypeInfo({ index, data }) { const [editField, setEditField] = useState({}); const { t } = useTranslation(); - // TODO: remove indexes, not a valid case after adding id to types const typeId = data.id ?? index; return ( @@ -34,7 +33,7 @@ export default function TypeInfo({ index, data }) { {data.name} } - itemKey={`${index}`} + itemKey={`${typeId}`} >
{t("name")}:
@@ -90,7 +89,7 @@ export default function TypeInfo({ index, data }) { />
{data.fields.map((f, j) => ( - + ))} { - if (index.name.trim() === "") { + if ((index.name || "").trim() === "") { issues.push(i18n.t("empty_index_name", { tableName: table.name })); } if (index.fields.length === 0) { diff --git a/src/utils/utils.js b/src/utils/utils.js index a9a1ddbb2..1fb2f7dd5 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -56,9 +56,14 @@ export function isFunction(str) { export function areFieldsCompatible(db, field1Type, field2Type) { const same = field1Type === field2Type; - const isCompatible = - dbToTypes[db][field1Type].compatibleWith && - dbToTypes[db][field1Type].compatibleWith.includes(field2Type); + + const dbTypes = dbToTypes[db]; + if (!dbTypes) return same; + + const typeConfig = dbTypes[field1Type]; + if (!typeConfig || !typeConfig.compatibleWith) return same; + + const isCompatible = typeConfig.compatibleWith.includes(field2Type); return same || isCompatible; }