Skip to content

Commit

Permalink
Fix crash when reassigning table region to normal region. (microsoft#829
Browse files Browse the repository at this point in the history
)
  • Loading branch information
buddhawang authored Jan 2, 2021
1 parent c279a3f commit 05b32a4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/react/components/pages/editorPage/canvas.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,7 @@ export default class Canvas extends React.Component<ICanvasProps, ICanvasState>
}
const regionIndex = this.state.currentAsset.regions.findIndex(r => r.id === region.id);
if (regionIndex !== -1) {
// TODO: update this part since we should not modify state directly.
this.state.currentAsset.regions.splice(regionIndex, 1, region);
}
});
Expand Down Expand Up @@ -537,6 +538,13 @@ export default class Canvas extends React.Component<ICanvasProps, ICanvasState>
}
selectedRegion.isTableRegion = true;
}
} else {
// non-table region, clear table related properties.
for(const region of selectedRegions) {
region.isTableRegion = false;
delete (region as ITableRegion).rowKey;
delete (region as ITableRegion).columnKey;
}
}

this.updateRegions([...selectedRegions, ...regions]);
Expand Down

0 comments on commit 05b32a4

Please sign in to comment.