Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
majian159 committed Sep 3, 2021
1 parent 263c190 commit 8ad3164
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const Traits: React.FC<FormPartProps<ComponentModel>> = (props) => {
);
};
instance.setValues = (vs) => {
vs?.traits.forEach((t) => {
vs?.traits?.forEach((t) => {
instances[t.type!].setValues(t);
});
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ const ComponentEditDrawer: React.FC<{

const [codeValue, setCodeValue] = useState<string>();
useEffect(() => {
if (mode === 'editor') {
if (mode === 'editor' && codeValue === undefined) {
setCodeValue(component == null ? '' : YAML.stringify(reverseComponent(component)));
}
}, [component, mode]);
}, [component, mode, codeValue]);

return (
<ProDrawer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ const ApplicationForm: React.FC<{
</ProCard>
<ProCard title="Add components" style={{ marginTop: '20px' }} headerBordered wrap>
<ProCard
colSpan={4}
colSpan={{ xs: 24, sm: 10, lg: 6, xxl: 4 }}
bordered
hoverable
onClick={() => {
Expand Down

0 comments on commit 8ad3164

Please sign in to comment.