Skip to content

Commit

Permalink
Merge pull request #1517 from rowyio/feat/auto-fill-table-id
Browse files Browse the repository at this point in the history
ROWY-2110 fix broken table id prefill for table setup
  • Loading branch information
shamsmosowi committed Jan 2, 2024
2 parents 34e9769 + c421071 commit 2b2e3b4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
7 changes: 2 additions & 5 deletions src/components/TableSettingsDialog/TableName.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export interface ITableNameProps extends IShortTextComponentProps {

export default function TableName({ watchedField, ...props }: ITableNameProps) {
const {
field: { onChange, value },
field: { onChange },
useFormMethods: { control },
disabled,
} = props;
Expand All @@ -25,12 +25,9 @@ export default function TableName({ watchedField, ...props }: ITableNameProps) {
if (!touched && typeof watchedValue === "string" && !!watchedValue) {
// if table name field is not touched, and watched value is valid, set table name to watched value
onChange(startCase(watchedValue));
} else if (typeof value === "string") {
// otherwise if table name is valid, set watched value to table name
onChange(startCase(value.trim()));
}
}
}, [watchedValue, disabled, onChange, value]);
}, [watchedValue, disabled]);

return <ShortTextComponent {...props} />;
}
2 changes: 1 addition & 1 deletion src/components/TableSettingsDialog/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ export const tableSettings = (
name: "name",
label: "Table name",
required: true,
watchedField: "name",
watchedField: "collection",
assistiveText: "User-facing name for this table",
autoFocus: true,
gridCols: { xs: 12, sm: 6 },
Expand Down

0 comments on commit 2b2e3b4

Please sign in to comment.