diff --git a/Composer/packages/extensions/obiformeditor/src/FormEditor.tsx b/Composer/packages/extensions/obiformeditor/src/FormEditor.tsx index c198c6688d..450cf8764d 100644 --- a/Composer/packages/extensions/obiformeditor/src/FormEditor.tsx +++ b/Composer/packages/extensions/obiformeditor/src/FormEditor.tsx @@ -3,7 +3,7 @@ /** @jsx jsx */ import { Global, jsx } from '@emotion/core'; -import React, { useState, useMemo } from 'react'; +import React, { useState, useMemo, useEffect } from 'react'; import { Dropdown } from 'office-ui-fabric-react/lib/Dropdown'; import { JSONSchema6Definition, JSONSchema6 } from 'json-schema'; import merge from 'lodash/merge'; @@ -34,6 +34,12 @@ export const FormEditor: React.FunctionComponent = props => { const [localData, setLocalData] = useState(data); const type = getType(localData); + useEffect(() => { + if (!isEqual(localData, data)) { + setLocalData(data); + } + }, [data]); + const formErrors = useMemo(() => { if (props.currentDialog && props.currentDialog.diagnostics) { const currentPath = props.focusPath.replace('#', '');