From a8f90152e4c8e24ab92e447300c5aada8fab59d6 Mon Sep 17 00:00:00 2001 From: zeye Date: Tue, 10 Dec 2019 20:06:16 +0800 Subject: [PATCH] use indexed `templates` in `lgFiles` --- Composer/packages/client/src/ShellApi.ts | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/Composer/packages/client/src/ShellApi.ts b/Composer/packages/client/src/ShellApi.ts index 2c97ff680c..5398c78c45 100644 --- a/Composer/packages/client/src/ShellApi.ts +++ b/Composer/packages/client/src/ShellApi.ts @@ -128,18 +128,10 @@ export const ShellApi: React.FC = () => { function getLgTemplates({ id }, event) { if (isEventSourceValid(event) === false) return false; - if (id === undefined) throw new Error('must have a file id'); const file = lgFiles.find(file => file.id === id); if (!file) throw new Error(`lg file ${id} not found`); - return lgUtil.parse(file.content).map(template => { - const { name, parameters, body } = template; - return { - name, - parameters, - body, - }; - }); + return file.templates; } /**