menu icon indicating copy to clipboard operation
menu copied to clipboard

props.parentMenu is undefined

Open adrianmisko opened this issue 6 years ago • 3 comments

All of the sudden my application started crashing at node_modules/antd/node_modules/rc-menu/es/SubMenu.js:260

260 | var getPopupContainer = props.parentMenu.isRootMenu ? props.parentMenu.props.getPopupContainer : function (triggerNode) {
     return triggerNode.parentNode; 
};

with an error: TypeError: props.parentMenu is undefined

I fixed it by coalescing the undefined:

var getPopupContainer = props.parentMenu ? props.parentMenu.isRootMenu ? props.parentMenu.props.getPopupContainer : function (triggerNode) {
      return triggerNode.parentNode;
 } : null;

But I don't really know if that's the best way to do this. I'm using rc-menu as a dependency of antd library.

adrianmisko avatar Mar 29 '19 00:03 adrianmisko

Did you have a reproducible demo?

afc163 avatar Mar 29 '19 03:03 afc163

This component uses the menu: https://github.com/adrianmisko/bookstore-spa/blob/master/src/components/Nav/Nav.js If I download snapshot of that repo and run npm install & umi dev the project crashes. Tomorrow I'll check earlier snapshot of this project and see if that works. Will also try to check it on different machine (mine is Ubuntu 18.04 LTS with node 11.3.0 and npm 6.7.0)

adrianmisko avatar Mar 29 '19 21:03 adrianmisko

Could you provide a reproducible demo by http://u.ant.design/codesandbox-repro?

afc163 avatar Mar 30 '19 05:03 afc163