alitajs / alita

A React framework based on umi.
https://alitajs.com
MIT License
793 stars 85 forks source link

keepalive 模板中有个bug #569

Closed johanazhu closed 1 year ago

johanazhu commented 1 year ago

报错信息如下: Cannot read properties of undefined (reading 'toLowerCase')

所属代码块: https://github.com/alitajs/alita/blob/master/packages/plugins/templates/keepalive/context.tpl#L148

xiaohuoni commented 1 year ago

怎么复现呢?看起来都是字符串

johanazhu commented 1 year ago

怎么复现呢?看起来都是字符串

就把 ant-design-pro + qiankun 的项目升级到最新版(引用了keep-alive)就报错了 报错信息如下: image 当我调试时,成这样: image

const fullPath = getFullPath(item.path?.toLowerCase(), parentPath?.toLowerCase()); 就可以了

xiaohuoni commented 1 year ago

可是 item.path 为什么为 undefined?

xiaohuoni commented 1 year ago

info - + @alita/plugins 3.2.22 info - + alita 3.2.27

这个版本先规避了,但是还是希望跟进 tem.path 为什么为 undefined

johanazhu commented 1 year ago

info - + @alita/plugins 3.2.22 info - + alita 3.2.27

这个版本先规避了,但是还是希望跟进 tem.path 为什么为 undefined

嗯嗯,我再查查是啥原因

johanazhu commented 1 year ago

找到原因了,如果在 conf/routes.ts 中配置404 页面,也就是 { component: './404' },当没有 path 参数,访问 item.path 自然是 undefined

xiaohuoni commented 1 year ago

ok,那就明白了,更新版本就可以。🌹

johanazhu commented 1 year ago

ok,那就明白了,更新版本就可以。🌹

🌹🌹