Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…mposer-1 into fixcheck

* 'fixcheck' of https://github.com/lei9444/BotFramework-Composer-1:
  update local data when data change out the form (microsoft#1808)
  • Loading branch information
alanlong9278 committed Dec 30, 2019
2 parents 24d83dc + 0ba0f19 commit 686c152
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -34,6 +34,12 @@ export const FormEditor: React.FunctionComponent<FormEditorProps> = 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('#', '');
Expand Down

0 comments on commit 686c152

Please sign in to comment.