Skip to content

Commit

Permalink
fix: Create bot from scratch may create a non-empty bot (#1796)
Browse files Browse the repository at this point in the history
* fix bug

* handle comments

* handle comments
  • Loading branch information
liweitian authored and boydc2014 committed Dec 30, 2019
1 parent 381cbe2 commit dc935a6
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions Composer/packages/client/src/CreationFlow/CreateOptions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import { choiceGroup, templateItem, optionRoot, optionIcon, placeholder } from '

export function CreateOptions(props) {
const [option, setOption] = useState('create');
const [template, setTemplate] = useState(null);
const { templates, onDismiss, onNext } = props;

const emptyBotKey = templates[1].id;
const [template, setTemplate] = useState(emptyBotKey);
function SelectOption(props) {
const { checked, text, key } = props;
return (
Expand Down Expand Up @@ -67,15 +67,14 @@ export function CreateOptions(props) {
};

const handleItemChange = (event, option) => {
setTemplate(option);
setTemplate(option.key);
};

const handleJumpToNext = () => {
if (option === 'Create from template') {
if (template === null) onNext(templates[0]);
else onNext(template.key);
onNext(template);
} else {
onNext(null);
onNext(emptyBotKey);
}
};

Expand Down

0 comments on commit dc935a6

Please sign in to comment.