allow table creation with _schema doc preset

This commit is contained in:
Sidney Alcantara
2022-04-06 16:05:16 +10:00
parent e148ffcd65
commit 7ad3ff2dc2
2 changed files with 11 additions and 3 deletions

View File

@@ -25,6 +25,7 @@ import {
TABLE_GROUP_SCHEMAS,
TABLE_SCHEMAS,
} from "@src/config/dbPaths";
import { Controller } from "react-hook-form";
export enum TableSettingsDialogModes {
create,
@@ -203,6 +204,13 @@ export default function TableSettings({
return (
<>
<Controller
control={formFieldsProps.control}
name="_schema"
defaultValue={{}}
render={() => <></>}
/>
<Stack
direction="row"
spacing={1}

View File

@@ -78,10 +78,10 @@ export default function HomePage() {
data: null,
});
const handleCreateTable = () =>
const handleCreateTable = (data?: null | (Table & { tableType: string })) =>
setSettingsDialogState({
mode: TableSettingsDialogModes.create,
data: null,
data: data || null,
});
const [settingsDocState] = useDoc(
@@ -107,7 +107,7 @@ export default function HomePage() {
<Fab
color="secondary"
aria-label="Create table"
onClick={handleCreateTable}
onClick={() => handleCreateTable()}
sx={{
zIndex: "speedDial",
position: "fixed",