ant-design / ant-design-pro

👨🏻‍💻👩🏻‍💻 Use Ant Design like a Pro!
https://pro.ant.design
MIT License
36.4k stars 8.14k forks source link

🧐[问题]TypeError: Cannot read property 'reduce' of undefined #6459

Closed andyyumiao closed 4 years ago

andyyumiao commented 4 years ago

🧐 问题描述

从官方模版导入查询列表模版,启动后,点击对应菜单,报这个错: TypeError: Cannot read property 'reduce' of undefined tableAlertRender src/pages/ClusterManager/HostManager/index.tsx:172 169 | ]} 170 | tableAlertRender={(selectedRowKeys, selectedRows) => ( 171 |

172 | 已选择 <a style={{ fontWeight: 600 }}>{selectedRowKeys.length} 项   | ^ 173 | 174 | 服务调用次数总计 {selectedRows.reduce((pre, item) => pre + item.callNo, 0)} 万 175 | View compiled (anonymous function) node_modules/@ant-design/pro-table/es/component/alert/index.js:47 44 | return null; 45 | } 46 | 47 | var dom = alertInfoRender({ | ^ 48 | intl: intl, 49 | selectedRowKeys: selectedRowKeys, 50 | selectedRows: selectedRows View compiled updateContextConsumer node_modules/react-dom/cjs/react-dom.development.js:18304 18301 | { 18302 | ReactCurrentOwner$1.current = workInProgress; 18303 | setIsRendering(true); 18304 | newChildren = render(newValue); | ^ 18305 | setIsRendering(false); 18306 | } // React DevTools reads this flag. 18307 | View compiled beginWork node_modules/react-dom/cjs/react-dom.development.js:18661 18658 | return updateContextProvider(current, workInProgress, renderExpirationTime); 18659 | 18660 | case ContextConsumer: 18661 | return updateContextConsumer(current, workInProgress, renderExpirationTime); | ^ 18662 | 18663 | case MemoComponent: 18664 | { View compiled HTMLUnknownElement.callCallback node_modules/react-dom/cjs/react-dom.development.js:188 185 | window.event = windowEvent; 186 | } 187 | 188 | func.apply(context, funcArgs); | ^ 189 | didError = false; 190 | } // Create a global error event handler. We use this to capture the value 191 | // that was thrown. It's possible that this error handler will fire more View compiled invokeGuardedCallbackDev node_modules/react-dom/cjs/react-dom.development.js:237 234 | // errors, it will trigger our global error handler. 235 | 236 | evt.initEvent(evtType, false, false); 237 | fakeNode.dispatchEvent(evt); | ^ 238 | 239 | if (windowEventDescriptor) { 240 | Object.defineProperty(window, 'event', windowEventDescriptor); View compiled invokeGuardedCallback node_modules/react-dom/cjs/react-dom.development.js:292 289 | function invokeGuardedCallback(name, func, context, a, b, c, d, e, f) { 290 | hasError = false; 291 | caughtError = null; 292 | invokeGuardedCallbackImpl$1.apply(reporter, arguments); 293 | } 294 | /* 295 | Same as invokeGuardedCallback, but instead of returning an error, it stores View compiled beginWork$1 node_modules/react-dom/cjs/react-dom.development.js:23203 23200 | } // Run beginWork again. 23201 | 23202 | 23203 | invokeGuardedCallback(null, beginWork, null, current, unitOfWork, expirationTime); | ^ 23204 | 23205 | if (hasCaughtError()) { 23206 | var replayError = clearCaughtError(); // invokeGuardedCallback sometimes sets an expando _suppressLogging. View compiled performUnitOfWork node_modules/react-dom/cjs/react-dom.development.js:22157 22154 | next = beginWork$1(current, unitOfWork, renderExpirationTime$1); 22155 | stopProfilerTimerIfRunningAndRecordDelta(unitOfWork, true); 22156 | } else { 22157 | next = beginWork$1(current, unitOfWork, renderExpirationTime$1); | ^ 22158 | } 22159 | 22160 | resetCurrentFiber(); View compiled workLoopSync node_modules/react-dom/cjs/react-dom.development.js:22130 22127 | function workLoopSync() { 22128 | // Already timed out, so perform work without checking if we need to yield. 22129 | while (workInProgress !== null) { 22130 | workInProgress = performUnitOfWork(workInProgress); 22131 | } 22132 | } 22133 | /* @noinline / View compiled performSyncWorkOnRoot node_modules/react-dom/cjs/react-dom.development.js:21756 21753 | 21754 | do { 21755 | try { 21756 | workLoopSync(); | ^ 21757 | break; 21758 | } catch (thrownValue) { 21759 | handleError(root, thrownValue); View compiled (anonymous function) node_modules/react-dom/cjs/react-dom.development.js:11089 11086 | var callback = queue[i]; 11087 | 11088 | do { 11089 | callback = callback(_isSync); | ^ 11090 | } while (callback !== null); 11091 | } 11092 | }); View compiled unstable_runWithPriority node_modules/scheduler/cjs/scheduler.development.js:653 650 | currentPriorityLevel = priorityLevel; 651 | 652 | try { 653 | return eventHandler(); | ^ 654 | } finally { 655 | currentPriorityLevel = previousPriorityLevel; 656 | } View compiled runWithPriority$1 node_modules/react-dom/cjs/react-dom.development.js:11039 11036 | 11037 | function runWithPriority$1(reactPriorityLevel, fn) { 11038 | var priorityLevel = reactPriorityToSchedulerPriority(reactPriorityLevel); 11039 | return Scheduler_runWithPriority(priorityLevel, fn); 11040 | } 11041 | function scheduleCallback(reactPriorityLevel, callback, options) { 11042 | var priorityLevel = reactPriorityToSchedulerPriority(reactPriorityLevel); View compiled flushSyncCallbackQueueImpl node_modules/react-dom/cjs/react-dom.development.js:11084 11081 | try { 11082 | var _isSync = true; 11083 | var queue = syncQueue; 11084 | runWithPriority$1(ImmediatePriority, function () { | ^ 11085 | for (; i < queue.length; i++) { 11086 | var callback = queue[i]; 11087 | View compiled flushSyncCallbackQueue node_modules/react-dom/cjs/react-dom.development.js:11072 11069 | Scheduler_cancelCallback(node); 11070 | } 11071 | 11072 | flushSyncCallbackQueueImpl(); 11073 | } 11074 | 11075 | function flushSyncCallbackQueueImpl() { View compiled discreteUpdates$1 node_modules/react-dom/cjs/react-dom.development.js:21893 21890 | 21891 | if (executionContext === NoContext) { 21892 | // Flush the immediate callbacks that were scheduled during this batch 21893 | flushSyncCallbackQueue(); 21894 | } 21895 | } 21896 | } View compiled discreteUpdates node_modules/react-dom/cjs/react-dom.development.js:806 803 | isInsideEventHandler = true; 804 | 805 | try { 806 | return discreteUpdatesImpl(fn, a, b, c, d); | ^ 807 | } finally { 808 | isInsideEventHandler = prevIsInsideEventHandler; 809 | View compiled dispatchDiscreteEvent node_modules/react-dom/cjs/react-dom.development.js:4168 4165 | 4166 | function dispatchDiscreteEvent(topLevelType, eventSystemFlags, container, nativeEvent) { 4167 | flushDiscreteUpdatesIfNeeded(nativeEvent.timeStamp); 4168 | discreteUpdates(dispatchEvent, topLevelType, eventSystemFlags, container, nativeEvent); 4169 | } 4170 | 4171 | function dispatchUserBlockingUpdate(topLevelType, eventSystemFlags, container, nativeEvent) {

💻 示例代码

🚑 其他信息

屏幕快照 2020-04-24 上午10 08 27
chenshuai2144 commented 4 years ago