ant-design / ant-design/pro-components

🐛[BUG]ProLayout会出现undefined is not iterable (cannot read property Symbol(Symbol.iterator))

Open
#7,773 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
4.8k
Forks
1.4k
Avg merge
10h 44m
Merged PRs (30d)
3

Description

### 🐛 bug 描述
ProLayout会出现undefined is not iterable (cannot read property Symbol(Symbol.iterator))

### 📷 复现步骤

hash路由模式下,直接更改路由地址复现

### 💻 复现代码

import { PageContainer, ProLayout } from "@ant-design/pro-components";
import { Space } from "antd";
import { FC, } from "react";
import { Outlet, } from "react-router-dom";
import { DownloadOutlined, UserOutlined } from "@ant-design/icons";
import logo from "@assets/logo.png";
import { useLocation,useMatches } from "react-router-dom";
import { getMenuData } from "@router/index";

const Layout: FC = () => {
const menuData=getMenuData();
const location=useLocation();
const matches=useMatches();
const breadcrumb=matches.filter(({handle}:any)=>!!handle?.breadcrumb).map(({handle,pathname}:any)=>({path:"/#"+pathname,title:handle.breadcrumb}));

return (

(menuData)}
breadcrumbRender={()=>breadcrumb}
location={location}
menu={{
defaultOpenAll:true
}}
headerContentRender={() => (






超级管理员



)}
>




);
};

export default Layout;

### © 版本信息

- ProComponents 版本: [2.6.20]
- 浏览器环境 chrome
- 开发环境 [window]

### 🚑 其他信息

![image](https://github.com/ant-design/pro-components/assets/26690052/af218603-2e1b-4599-9551-6d3110a8fcf3)

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue in a TypeScript React app using ProLayout, PageContainer, useMatches, and hash routing, then inspect the ProLayout routing and breadcrumb entry points. Done means changing the route directly in hash mode no longer throws the reported iterator error; the issue does not identify a file or test to run.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.