Skip to content

Commit

Permalink
fix visibilityState status error
Browse files Browse the repository at this point in the history
  • Loading branch information
chenshuai2144 committed Oct 9, 2019
1 parent 913f3e4 commit 511e18b
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,16 @@ const Adder: React.FC<AdderProps> = props => {
api.listenRemote({
type: 'org.umi.block.add-blocks-success',
onMessage: msg => {
setTaskLoading(false);
onAddBlockChange(undefined);

// 如果标签页不激活,不处理它
if (document.visibilityState !== 'hidden') {
setTaskLoading(false);
onAddBlockChange(undefined);

// 设置预览界面
setAddStatus('result');
setSucceededBlock(msg.data);
} else {
setAddStatus('form');
}
},
});
Expand Down

0 comments on commit 511e18b

Please sign in to comment.