Skip to content

Commit

Permalink
Merge pull request alibaba-fusion#1553 from youluna/enhance-robotness
Browse files Browse the repository at this point in the history
chore(*): add try catch to enhance robotness
  • Loading branch information
youluna authored Feb 5, 2020
2 parents 20d2212 + d28fd47 commit a8a95e2
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 6 deletions.
6 changes: 5 additions & 1 deletion src/overlay/gateway.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ export default class Gateway extends Component {
}

getChildNode() {
return findDOMNode(this.child);
try {
return findDOMNode(this.child);
} catch (err) {
return null;
}
}

saveChildRef = ref => {
Expand Down
6 changes: 5 additions & 1 deletion src/overlay/overlay.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,11 @@ export default class Overlay extends Component {
}

getContentNode() {
return findDOMNode(this.contentRef);
try {
return findDOMNode(this.contentRef);
} catch (err) {
return null;
}
}

getWrapperNode() {
Expand Down
6 changes: 5 additions & 1 deletion src/overlay/position.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,11 @@ export default class Position extends Component {
}

getContentNode() {
return findDOMNode(this);
try {
return findDOMNode(this);
} catch (err) {
return null;
}
}

getTargetNode() {
Expand Down
6 changes: 5 additions & 1 deletion src/overlay/utils/find-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ export default function findNode(target, param) {
}

if (typeof target === 'function') {
target = target(param);
try {
target = target(param);
} catch (err) {
target = null;
}
}

if (!target) {
Expand Down
11 changes: 9 additions & 2 deletions src/table/lock.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,15 @@ export default function lock(BaseComponent) {
}
);

const node = findDOMNode(this);
const width = node.clientWidth;
let node, width;

try {
node = findDOMNode(this);
width = node.clientWidth;
} catch (err) {
node = null;
width = 0;
}

// if the table doesn't exist, there is no need to adjust
if (width === 0) {
Expand Down

0 comments on commit a8a95e2

Please sign in to comment.