Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feat]:加入自定义hook的问题 #68

Open
exqmjmz opened this issue Nov 26, 2023 · 13 comments
Open

[Feat]:加入自定义hook的问题 #68

exqmjmz opened this issue Nov 26, 2023 · 13 comments
Labels
enhancement New feature or request

Comments

@exqmjmz
Copy link

exqmjmz commented Nov 26, 2023

我想在currentUser这个全局变量中加入能获取到这个用户角色可以访问的应用,通过接口查到,获取能访问的应用是通过folderElementsSelector获取,当我在
client\packages\lowcoder\src\comps\hooks\hookComp.tsx
加入以下代码时会直接报错

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;
});

如果我想加入一个或者修改原有的hook,请问有什么建议或者该如何操作?
报错如下:

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
runWithPriority$1 @ 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
runWithPriority$1 @ 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
runWithPriority$1 @ 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
runWithPriority$1 @ 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
beginWork$1 @ 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
runWithPriority$1 @ 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
runWithPriority$1 @ 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)
    ```
@exqmjmz exqmjmz added the enhancement New feature or request label Nov 26, 2023
@mousheng
Copy link
Owner

从报错来看,你是在钩子里面调用了钩子,导致钩子循环嵌套了
从我测试来看,在函数CurrentUserHookComp 里添加属性是行得通的
image

@exqmjmz
Copy link
Author

exqmjmz commented Nov 26, 2023

从报错来看,你是在钩子里面调用了钩子,导致钩子循环嵌套了 从我测试来看,在函数CurrentUserHookComp 里添加属性是行得通的 image

换了另外一种方式绕过去了
直接在getCurrentUser获取具体的用户信息时,一并获取对应授权的app
image

image

通过把授权的应用加载进来,可以通过配置grid布局方式,单独创建应用首页,把这个默认页设置成默认应用,用户进来显示的第一个页面就是这个应用页面,再通过这个页面跳转到别的应用。
而不是进入到lowcoder自带的,因为自带的还会显示出其他如模块、导航、文件夹这种界面,对应实际使用的用户来讲过于混乱了

image

@mousheng
Copy link
Owner

image
应该能实现你的需求,另外,没用的属性可以不用打印,pick你需要的属性,渲染列表开销比较大

@exqmjmz
Copy link
Author

exqmjmz commented Nov 26, 2023

image 应该能实现你的需求,另外,没用的属性可以不用打印,pick你需要的属性,渲染列表开销比较大

明白,渲染这点也发现了,组件多和属性多的情况下,editor页面会卡顿

@mousheng
Copy link
Owner

你这个自定义导航页的想法很不错!
但是放在currentUser还是觉得不是很理想,随着App多了的话,没必要浪费这部分开销,我后面有空的话把查询可访问页面搞到lowcoder_API里吧,不过这得改后端,JAVA不熟 - -!到时候先试一试吧
image

@exqmjmz
Copy link
Author

exqmjmz commented Nov 26, 2023

你这个自定义导航页的想法很不错! 但是放在currentUser还是觉得不是很理想,随着App多了的话,没必要浪费这部分开销,我后面有空的话把查询可访问页面搞到lowcoder_API里吧,不过这得改后端,JAVA不熟 - -!到时候先试一试吧 image

JAVA不熟+1,之前有想过专门针对每个用户群,可以设置多个APP应用,如果是一个APP应用就跳转到这个应用。如果是多个的,就单独跳转到一个独立页面,做选择后再跳转。

@exqmjmz
Copy link
Author

exqmjmz commented Nov 26, 2023

同时再问一下,自定义数据源的文档有吗?
想尝试加入自定义JavaScript脚本作为数据源,新建脚本后直接默认挂载到window或者也可以通过定义好传参,然后多个地方都可以直接引用,也可以在这个地方调用
image

现在两种引用外部js方式,或多或少到后期都有不方便的地方

采用库的方式引用,不方便修改
采用高级设置的方式引用,如果脚本一多了,也不好维护

@mousheng
Copy link
Owner

哎。。。。哪来的文档啊,组件文档我都没时间写

@exqmjmz
Copy link
Author

exqmjmz commented Nov 27, 2023

哎。。。。哪来的文档啊,组件文档我都没时间写

我回头整理一下我这边改过的,之前试过给组件标题加入大小、粗体的样式属性

@exqmjmz
Copy link
Author

exqmjmz commented Nov 27, 2023

哎。。。。哪来的文档啊,组件文档我都没时间写

找到了,在lowcoder官网上有,自定义数据源的文档
https://docs.lowcoder.cloud/lowcoder-documentation/lowcoder-extension/develop-data-source-plugins

@mousheng
Copy link
Owner

有空我研究看看

@mousheng
Copy link
Owner

mousheng commented Dec 1, 2023

@LJM000 已经添加了lowcoder API查询可访问App的方法,你可以试一下有没有问题

@exqmjmz
Copy link
Author

exqmjmz commented Dec 1, 2023

@LJM000 已经添加了lowcoder API查询可访问App的方法,你可以试一下有没有问题

已经看到对应文档

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants