-
Notifications
You must be signed in to change notification settings - Fork 268
-
I want to add new attr to the currentUser global variable.The new attr is elements.This attr is use to get user app with permissions.
client\packages\lowcoder\src\comps\hooks\hookComp.tsx
add code:
const CurrentUserHookComp = hookToStateComp(() => { const user = useCurrentUser(); const elements = useSelector(folderElementsSelector)[""]; const elementsAny: any[] = elements.map((item) => item as any); const updatedUser = { ...user, elements: elementsAny }; return updatedUser; });
an error occurred
How should I implement add custom hook?
error msg
ncaught Error: Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.
at checkForNestedUpdates (react-dom.development.js:23803:15)
at scheduleUpdateOnFiber (react-dom.development.js:21835:3)
at dispatchAction (react-dom.development.js:16139:5)
at useDiffItem.js:19:5
at invokePassiveEffectCreate (react-dom.development.js:23487:20)
at HTMLUnknownElement.callCallback2 (react-dom.development.js:3945:14)
at Object.invokeGuardedCallbackDev (react-dom.development.js:3994:16)
at invokeGuardedCallback (react-dom.development.js:4056:31)
at flushPassiveEffectsImpl (react-dom.development.js:23574:9)
at unstable_runWithPriority (scheduler.development.js:468:12)
checkForNestedUpdates @ react-dom.development.js:23803
scheduleUpdateOnFiber @ react-dom.development.js:21835
dispatchAction @ react-dom.development.js:16139
(anonymous) @ useDiffItem.js:19
invokePassiveEffectCreate @ react-dom.development.js:23487
callCallback2 @ react-dom.development.js:3945
invokeGuardedCallbackDev @ react-dom.development.js:3994
invokeGuardedCallback @ react-dom.development.js:4056
flushPassiveEffectsImpl @ react-dom.development.js:23574
unstable_runWithPriority @ scheduler.development.js:468
runWithPriority1ドル @ react-dom.development.js:11276
flushPassiveEffects @ react-dom.development.js:23447
performSyncWorkOnRoot @ react-dom.development.js:22269
(anonymous) @ react-dom.development.js:11327
unstable_runWithPriority @ scheduler.development.js:468
runWithPriority1ドル @ react-dom.development.js:11276
flushSyncCallbackQueueImpl @ react-dom.development.js:11322
flushSyncCallbackQueue @ react-dom.development.js:11309
scheduleUpdateOnFiber @ react-dom.development.js:21893
dispatchAction @ react-dom.development.js:16139
forceUpdate2 @ useKeyRecords.js:29
(anonymous) @ useKeyRecords.js:46
Promise.then(异步)
nextSlice @ timeUtil.js:3
(anonymous) @ useKeyRecords.js:44
(anonymous) @ MenuItem.js:200
invokePassiveEffectCreate @ react-dom.development.js:23487
callCallback2 @ react-dom.development.js:3945
invokeGuardedCallbackDev @ react-dom.development.js:3994
invokeGuardedCallback @ react-dom.development.js:4056
flushPassiveEffectsImpl @ react-dom.development.js:23574
unstable_runWithPriority @ scheduler.development.js:468
runWithPriority1ドル @ react-dom.development.js:11276
flushPassiveEffects @ react-dom.development.js:23447
performSyncWorkOnRoot @ react-dom.development.js:22269
(anonymous) @ react-dom.development.js:11327
unstable_runWithPriority @ scheduler.development.js:468
runWithPriority1ドル @ react-dom.development.js:11276
flushSyncCallbackQueueImpl @ react-dom.development.js:11322
flushSyncCallbackQueue @ react-dom.development.js:11309
scheduleUpdateOnFiber @ react-dom.development.js:21893
dispatchAction @ react-dom.development.js:16139
Promise.then(异步)
useCompInstance @ useCompInstance.tsx:297
useRootCompInstance @ appEditorInternal.tsx:90
AppEditor @ AppEditor.tsx:68
renderWithHooks @ react-dom.development.js:14985
updateFunctionComponent @ react-dom.development.js:17356
beginWork @ react-dom.development.js:19063
beginWork1ドル @ react-dom.development.js:23940
performUnitOfWork @ react-dom.development.js:22776
workLoopSync @ react-dom.development.js:22707
renderRootSync @ react-dom.development.js:22670
performSyncWorkOnRoot @ react-dom.development.js:22293
(anonymous) @ react-dom.development.js:11327
unstable_runWithPriority @ scheduler.development.js:468
runWithPriority1ドル @ react-dom.development.js:11276
flushSyncCallbackQueueImpl @ react-dom.development.js:11322
flushSyncCallbackQueue @ react-dom.development.js:11309
scheduleUpdateOnFiber @ react-dom.development.js:21893
dispatchAction @ react-dom.development.js:16139
onSuccess @ AppEditor.tsx:117
fetchApplicationDetailSaga @ applicationSagas.ts:219
next @ redux-saga-core.esm.js:1157
currCb @ redux-saga-core.esm.js:1251
Promise.then(异步)
resolvePromise @ redux-saga-core.esm.js:395
runCallEffect @ redux-saga-core.esm.js:527
runEffect @ redux-saga-core.esm.js:1204
digestEffect @ redux-saga-core.esm.js:1271
next @ redux-saga-core.esm.js:1161
proc @ redux-saga-core.esm.js:1108
(anonymous) @ redux-saga-core.esm.js:585
immediately @ redux-saga-core.esm.js:56
runForkEffect @ redux-saga-core.esm.js:584
runEffect @ redux-saga-core.esm.js:1204
digestEffect @ redux-saga-core.esm.js:1271
next @ redux-saga-core.esm.js:1161
currCb @ redux-saga-core.esm.js:1251
takeCb2 @ redux-saga-core.esm.js:503
put @ redux-saga-core.esm.js:339
(anonymous) @ redux-saga-core.esm.js:376
exec @ redux-saga-core.esm.js:31
flush @ redux-saga-core.esm.js:87
asap @ redux-saga-core.esm.js:46
runPutEffect @ redux-saga-core.esm.js:468
runEffect @ redux-saga-core.esm.js:1204
digestEffect @ redux-saga-core.esm.js:1271
next @ redux-saga-core.esm.js:1161
currCb @ redux-saga-core.esm.js:1251
Promise.then(异步)
resolvePromise @ redux-saga-core.esm.js:395
runCallEffect @ redux-saga-core.esm.js:527
runEffect @ redux-saga-core.esm.js:1204
digestEffect @ redux-saga-core.esm.js:1271
next @ redux-saga-core.esm.js:1161
proc @ redux-saga-core.esm.js:1108
(anonymous) @ redux-saga-core.esm.js:585
immediately @ redux-saga-core.esm.js:56
runForkEffect @ redux-saga-core.esm.js:584
runEffect @ redux-saga-core.esm.js:1204
digestEffect @ redux-saga-core.esm.js:1271
next @ redux-saga-core.esm.js:1161
currCb @ redux-saga-core.esm.js:1251
takeCb2 @ redux-saga-core.esm.js:503
put @ redux-saga-core.esm.js:339
(anonymous) @ redux-saga-core.esm.js:376
exec @ redux-saga-core.esm.js:31
flush @ redux-saga-core.esm.js:87
asap @ redux-saga-core.esm.js:46
chan.put @ redux-saga-core.esm.js:375
(anonymous) @ redux-saga-core.esm.js:1412
dispatchRecurse @ reduxBatch.js:60
dispatch @ reduxBatch.js:72
getCurrentUser @ app.tsx:181
componentDidMount @ app.tsx:84
commitLifeCycles @ react-dom.development.js:20663
commitLayoutEffects @ react-dom.development.js:23426
callCallback2 @ react-dom.development.js:3945
invokeGuardedCallbackDev @ react-dom.development.js:3994
invokeGuardedCallback @ react-dom.development.js:4056
commitRootImpl @ react-dom.development.js:23151
unstable_runWithPriority @ scheduler.development.js:468
runWithPriority1ドル @ react-dom.development.js:11276
commitRoot @ react-dom.development.js:22990
performSyncWorkOnRoot @ react-dom.development.js:22329
scheduleUpdateOnFiber @ react-dom.development.js:21881
updateContainer @ react-dom.development.js:25482
(anonymous) @ react-dom.development.js:26021
unbatchedUpdates @ react-dom.development.js:22431
legacyRenderSubtreeIntoContainer @ react-dom.development.js:26020
render @ react-dom.development.js:26103
bootstrap @ app.tsx:191
(anonymous) @ index.ts:39
Show 121 more frames
显示简略信息
useCompInstance.tsx:297 The above error occurred in the <List> component:
at RawList (http://localhost:8000/node_modules/.vite/deps/chunk-MHNYKA2V.js?v=ea53131c:769:32)
at http://localhost:8000/node_modules/.vite/deps/chunk-LQEMSYXI.js?v=ea53131c:1891:29
at div
at Tree2 (http://localhost:8000/node_modules/.vite/deps/chunk-LQEMSYXI.js?v=ea53131c:2287:9)
at http://localhost:8000/node_modules/.vite/deps/antd.js?v=ea53131c:56619:30
at DirectoryTree (http://localhost:8000/node_modules/.vite/deps/antd.js?v=ea53131c:56806:5)
at P2 (http://localhost:8000/node_modules/.vite/deps/styled-components.js?v=ea53131c:1129:6)
at span
at div
at P2 (http://localhost:8000/node_modules/.vite/deps/styled-components.js?v=ea53131c:1129:6)
at div
at P2 (http://localhost:8000/node_modules/.vite/deps/styled-components.js?v=ea53131c:1129:6)
at BaseSection (http://localhost:8000/@fs/D:/code/lowcoder-2.1.7/client/packages/lowcoder-design/src/components/Section.tsx:97:5)
at div
at div
at div
at div
at div
at div
at div
at http://localhost:8000/node_modules/.vite/deps/simplebar-react.js?v=ea53131c:1908:23
at div
at P2 (http://localhost:8000/node_modules/.vite/deps/styled-components.js?v=ea53131c:1129:6)
at ScrollBar (http://localhost:8000/@fs/D:/code/lowcoder-2.1.7/client/packages/lowcoder-design/src/components/ScrollBar.tsx:54:5)
at div
at P2 (http://localhost:8000/node_modules/.vite/deps/styled-components.js?v=ea53131c:1129:6)
at LeftContent (http://localhost:8000/src/pages/editor/LeftContent.tsx:274:5)
at div
at Card (http://localhost:8000/src/pages/common/styledComponent.tsx:35:3)
at P2 (http://localhost:8000/node_modules/.vite/deps/styled-components.js?v=ea53131c:1129:6)
at div
at P2 (http://localhost:8000/node_modules/.vite/deps/styled-components.js?v=ea53131c:1129:6)
at div
at GlobalShortcutsWrapper (http://localhost:8000/src/util/keyUtils.tsx:158:5)
at EditorGlobalHotKeys (http://localhost:8000/src/pages/editor/editorHotKeys.tsx:101:23)
at div
at P2 (http://localhost:8000/node_modules/.vite/deps/styled-components.js?v=ea53131c:1129:6)
at EditorView (http://localhost:8000/src/pages/editor/editorView.tsx:189:5)
at div
at RootView (http://localhost:8000/src/comps/comps/rootComp.tsx?t=1701005699334:56:24)
at LocaleProvider (http://localhost:8000/node_modules/.vite/deps/chunk-NMSLX2TJ.js?v=ea53131c:2594:13)
at MotionWrapper (http://localhost:8000/node_modules/.vite/deps/chunk-NMSLX2TJ.js?v=ea53131c:3853:5)
at ProviderChildren (http://localhost:8000/node_modules/.vite/deps/chunk-NMSLX2TJ.js?v=ea53131c:3962:5)
at ConfigProvider (http://localhost:8000/node_modules/.vite/deps/chunk-NMSLX2TJ.js?v=ea53131c:4182:27)
at AppEditorInternalView (http://localhost:8000/src/pages/editor/appEditorInternal.tsx?t=1701005699334:109:26)
at AppEditor (http://localhost:8000/src/pages/editor/AppEditor.tsx?t=1701005699334:43:27)
at Route2 (http://localhost:8000/node_modules/.vite/deps/chunk-4Z54LJ33.js?v=ea53131c:942:29)
at Switch2 (http://localhost:8000/node_modules/.vite/deps/chunk-4Z54LJ33.js?v=ea53131c:1086:29)
at Router2 (http://localhost:8000/node_modules/.vite/deps/chunk-4Z54LJ33.js?v=ea53131c:655:30)
at div
at App (http://localhost:8000/node_modules/.vite/deps/antd.js?v=ea53131c:17366:16)
at LocaleProvider (http://localhost:8000/node_modules/.vite/deps/chunk-NMSLX2TJ.js?v=ea53131c:2594:13)
at MotionWrapper (http://localhost:8000/node_modules/.vite/deps/chunk-NMSLX2TJ.js?v=ea53131c:3853:5)
at ProviderChildren (http://localhost:8000/node_modules/.vite/deps/chunk-NMSLX2TJ.js?v=ea53131c:3962:5)
at ConfigProvider (http://localhost:8000/node_modules/.vite/deps/chunk-NMSLX2TJ.js?v=ea53131c:4182:27)
at Wrapper (http://localhost:8000/src/app.tsx?t=1701005699334:69:23)
at AppIndex (http://localhost:8000/src/app.tsx?t=1701005699334:81:1)
at ConnectFunction (http://localhost:8000/node_modules/.vite/deps/react-redux.js?v=ea53131c:543:48)
at Provider (http://localhost:8000/node_modules/.vite/deps/react-redux.js?v=ea53131c:371:20)
Consider adding an error boundary to your tree to customize error handling behavior.
Visit https://reactjs.org/link/error-boundaries to learn more about error boundaries.
useCompInstance.tsx:297 The above error occurred in the <List> component:
at RawList (http://localhost:8000/node_modules/.vite/deps/chunk-MHNYKA2V.js?v=ea53131c:769:32)
at http://localhost:8000/node_modules/.vite/deps/chunk-LQEMSYXI.js?v=ea53131c:1891:29
at div
at Tree2 (http://localhost:8000/node_modules/.vite/deps/chunk-LQEMSYXI.js?v=ea53131c:2287:9)
at http://localhost:8000/node_modules/.vite/deps/antd.js?v=ea53131c:56619:30
at DirectoryTree (http://localhost:8000/node_modules/.vite/deps/antd.js?v=ea53131c:56806:5)
at P2 (http://localhost:8000/node_modules/.vite/deps/styled-components.js?v=ea53131c:1129:6)
at span
at div
at P2 (http://localhost:8000/node_modules/.vite/deps/styled-components.js?v=ea53131c:1129:6)
at div
at P2 (http://localhost:8000/node_modules/.vite/deps/styled-components.js?v=ea53131c:1129:6)
at BaseSection (http://localhost:8000/@fs/D:/code/lowcoder-2.1.7/client/packages/lowcoder-design/src/components/Section.tsx:97:5)
at div
at div
at div
at div
at div
at div
at div
at http://localhost:8000/node_modules/.vite/deps/simplebar-react.js?v=ea53131c:1908:23
at div
at P2 (http://localhost:8000/node_modules/.vite/deps/styled-components.js?v=ea53131c:1129:6)
at ScrollBar (http://localhost:8000/@fs/D:/code/lowcoder-2.1.7/client/packages/lowcoder-design/src/components/ScrollBar.tsx:54:5)
at div
at P2 (http://localhost:8000/node_modules/.vite/deps/styled-components.js?v=ea53131c:1129:6)
at LeftContent (http://localhost:8000/src/pages/editor/LeftContent.tsx:274:5)
at div
at Card (http://localhost:8000/src/pages/common/styledComponent.tsx:35:3)
at P2 (http://localhost:8000/node_modules/.vite/deps/styled-components.js?v=ea53131c:1129:6)
at div
at P2 (http://localhost:8000/node_modules/.vite/deps/styled-components.js?v=ea53131c:1129:6)
at div
at GlobalShortcutsWrapper (http://localhost:8000/src/util/keyUtils.tsx:158:5)
at EditorGlobalHotKeys (http://localhost:8000/src/pages/editor/editorHotKeys.tsx:101:23)
at div
at P2 (http://localhost:8000/node_modules/.vite/deps/styled-components.js?v=ea53131c:1129:6)
at EditorView (http://localhost:8000/src/pages/editor/editorView.tsx:189:5)
at div
at RootView (http://localhost:8000/src/comps/comps/rootComp.tsx?t=1701005699334:56:24)
at LocaleProvider (http://localhost:8000/node_modules/.vite/deps/chunk-NMSLX2TJ.js?v=ea53131c:2594:13)
at MotionWrapper (http://localhost:8000/node_modules/.vite/deps/chunk-NMSLX2TJ.js?v=ea53131c:3853:5)
at ProviderChildren (http://localhost:8000/node_modules/.vite/deps/chunk-NMSLX2TJ.js?v=ea53131c:3962:5)
at ConfigProvider (http://localhost:8000/node_modules/.vite/deps/chunk-NMSLX2TJ.js?v=ea53131c:4182:27)
at AppEditorInternalView (http://localhost:8000/src/pages/editor/appEditorInternal.tsx?t=1701005699334:109:26)
at AppEditor (http://localhost:8000/src/pages/editor/AppEditor.tsx?t=1701005699334:43:27)
at Route2 (http://localhost:8000/node_modules/.vite/deps/chunk-4Z54LJ33.js?v=ea53131c:942:29)
at Switch2 (http://localhost:8000/node_modules/.vite/deps/chunk-4Z54LJ33.js?v=ea53131c:1086:29)
at Router2 (http://localhost:8000/node_modules/.vite/deps/chunk-4Z54LJ33.js?v=ea53131c:655:30)
at div
at App (http://localhost:8000/node_modules/.vite/deps/antd.js?v=ea53131c:17366:16)
at LocaleProvider (http://localhost:8000/node_modules/.vite/deps/chunk-NMSLX2TJ.js?v=ea53131c:2594:13)
at MotionWrapper (http://localhost:8000/node_modules/.vite/deps/chunk-NMSLX2TJ.js?v=ea53131c:3853:5)
at ProviderChildren (http://localhost:8000/node_modules/.vite/deps/chunk-NMSLX2TJ.js?v=ea53131c:3962:5)
at ConfigProvider (http://localhost:8000/node_modules/.vite/deps/chunk-NMSLX2TJ.js?v=ea53131c:4182:27)
at Wrapper (http://localhost:8000/src/app.tsx?t=1701005699334:69:23)
at AppIndex (http://localhost:8000/src/app.tsx?t=1701005699334:81:1)
at ConnectFunction (http://localhost:8000/node_modules/.vite/deps/react-redux.js?v=ea53131c:543:48)
at Provider (http://localhost:8000/node_modules/.vite/deps/react-redux.js?v=ea53131c:371:20)
Consider adding an error boundary to your tree to customize error handling behavior.
Visit https://reactjs.org/link/error-boundaries to learn more about error boundaries.
react-dom.development.js:23803 Uncaught (in promise) Error: Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.
at checkForNestedUpdates (react-dom.development.js:23803:15)
at scheduleUpdateOnFiber (react-dom.development.js:21835:3)
at dispatchAction (react-dom.development.js:16139:5)
at useDiffItem.js:19:5
at invokePassiveEffectCreate (react-dom.development.js:23487:20)
at HTMLUnknownElement.callCallback2 (react-dom.development.js:3945:14)
at Object.invokeGuardedCallbackDev (react-dom.development.js:3994:16)
at invokeGuardedCallback (react-dom.development.js:4056:31)
at flushPassiveEffectsImpl (react-dom.development.js:23574:9)
at unstable_runWithPriority (scheduler.development.js:468:12)
```
```
react-dom.development.js:67 Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in a useEffect cleanup function.
at Overflow (http://localhost:8000/node_modules/.vite/deps/antd.js?v=ea53131c:20215:32)
at InheritableContextProvider (http://localhost:8000/node_modules/.vite/deps/antd.js?v=ea53131c:20628:23)
at http://localhost:8000/node_modules/.vite/deps/antd.js?v=ea53131c:22431:43
at http://localhost:8000/node_modules/.vite/deps/antd.js?v=ea53131c:24499:29
at http://localhost:8000/node_modules/.vite/deps/antd.js?v=ea53131c:24603:45
at div
at aside
at http://localhost:8000/node_modules/.vite/deps/antd_lib_layout_Sider.js?v=ea53131c:798:20
at div
at P2 (http://localhost:8000/node_modules/.vite/deps/styled-components.js?v=ea53131c:1129:6)
at div
at P2 (http://localhost:8000/node_modules/.vite/deps/styled-components.js?v=ea53131c:1129:6)
at div
at GlobalShortcutsWrapper (http://localhost:8000/src/util/keyUtils.tsx:158:5)
at EditorGlobalHotKeys (http://localhost:8000/src/pages/editor/editorHotKeys.tsx:101:23)
at div
at P2 (http://localhost:8000/node_modules/.vite/deps/styled-components.js?v=ea53131c:1129:6)
at EditorView (http://localhost:8000/src/pages/editor/editorView.tsx:189:5)
at div
at RootView (http://localhost:8000/src/comps/comps/rootComp.tsx?t=1701005699334:56:24)
at LocaleProvider (http://localhost:8000/node_modules/.vite/deps/chunk-NMSLX2TJ.js?v=ea53131c:2594:13)
at MotionWrapper (http://localhost:8000/node_modules/.vite/deps/chunk-NMSLX2TJ.js?v=ea53131c:3853:5)
at ProviderChildren (http://localhost:8000/node_modules/.vite/deps/chunk-NMSLX2TJ.js?v=ea53131c:3962:5)
at ConfigProvider (http://localhost:8000/node_modules/.vite/deps/chunk-NMSLX2TJ.js?v=ea53131c:4182:27)
at AppEditorInternalView (http://localhost:8000/src/pages/editor/appEditorInternal.tsx?t=1701005699334:109:26)
at AppEditor (http://localhost:8000/src/pages/editor/AppEditor.tsx?t=1701005699334:43:27)
at Route2 (http://localhost:8000/node_modules/.vite/deps/chunk-4Z54LJ33.js?v=ea53131c:942:29)
at Switch2 (http://localhost:8000/node_modules/.vite/deps/chunk-4Z54LJ33.js?v=ea53131c:1086:29)
at Router2 (http://localhost:8000/node_modules/.vite/deps/chunk-4Z54LJ33.js?v=ea53131c:655:30)
at div
at App (http://localhost:8000/node_modules/.vite/deps/antd.js?v=ea53131c:17366:16)
at LocaleProvider (http://localhost:8000/node_modules/.vite/deps/chunk-NMSLX2TJ.js?v=ea53131c:2594:13)
at MotionWrapper (http://localhost:8000/node_modules/.vite/deps/chunk-NMSLX2TJ.js?v=ea53131c:3853:5)
at ProviderChildren (http://localhost:8000/node_modules/.vite/deps/chunk-NMSLX2TJ.js?v=ea53131c:3962:5)
at ConfigProvider (http://localhost:8000/node_modules/.vite/deps/chunk-NMSLX2TJ.js?v=ea53131c:4182:27)
at Wrapper (http://localhost:8000/src/app.tsx?t=1701005699334:69:23)
at AppIndex (http://localhost:8000/src/app.tsx?t=1701005699334:81:1)
at ConnectFunction (http://localhost:8000/node_modules/.vite/deps/react-redux.js?v=ea53131c:543:48)
at Provider (http://localhost:8000/node_modules/.vite/deps/react-redux.js?v=ea53131c:371:20)
```
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment