Skip to content

Commit

Permalink
Fix: Column name starting with numbers (#1718)
Browse files Browse the repository at this point in the history
* validating column name

* showing error note on fail add column op
  • Loading branch information
sadakchap authored May 31, 2021
1 parent 0ee0ae6 commit 39396ff
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/dashboard/Data/Browser/AddColumnDialog.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
} from 'lib/Constants';

function validColumnName(name) {
return !!name.match(/^[a-zA-Z0-9][_a-zA-Z0-9]*$/);
return !!name.match(/^[a-zA-Z][_a-zA-Z0-9]*$/);
}

export default class AddColumnDialog extends React.Component {
Expand Down
4 changes: 3 additions & 1 deletion src/dashboard/Data/Browser/Browser.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,9 @@ class Browser extends DashboardView {
required,
defaultValue
};
this.props.schema.dispatch(ActionTypes.ADD_COLUMN, payload).finally(() => {
this.props.schema.dispatch(ActionTypes.ADD_COLUMN, payload).catch((err) => {
this.showNote(err.message, true);
}).finally(() => {
this.setState({ showAddColumnDialog: false });
});
}
Expand Down

0 comments on commit 39396ff

Please sign in to comment.