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

Use component registry to make the body of the LinkView page customisable #6465

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

JeffersonBledsoe
Copy link
Member

@JeffersonBledsoe JeffersonBledsoe commented Nov 4, 2024


If your pull request closes an open issue, include the exact text below, immediately followed by the issue number. When your pull request gets merged, then that issue will close automatically.

Closes #

Copy link

netlify bot commented Nov 4, 2024

Deploy Preview for plone-components canceled.

Name Link
🔨 Latest commit d39c57a
🔍 Latest deploy log https://app.netlify.com/sites/plone-components/deploys/6749a8f8ae812f0008d6f3a2

@JeffersonBledsoe JeffersonBledsoe changed the title Use component registry to make the body of the LinkView page customis… Use component registry to make the body of the LinkView page customisable Nov 4, 2024
Copy link
Member

@davisagli davisagli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like a good idea to me, I have one small suggestion.

packages/volto/src/components/theme/View/LinkView.jsx Outdated Show resolved Hide resolved
@davisagli
Copy link
Member

@JeffersonBledsoe unit tests are failing because the snapshots need to be updated

@JeffersonBledsoe
Copy link
Member Author

@davisagli I tried updating the snapshots locally, but ran into this not-so-nice looking test fail for alot of components (shown at end of comment).

It seems that the changes to the test-setup-config.jsx file are causing this. Specifically, component: DefaultLinkViewBody,. If I just use a mocked component like in the comment above this line, I don't run into any issues.
I've played about with the component a bit, and it seems to be the rendering of the <UniversalLink> component within the DefaultLinkViewBody that causes it to break. Any ideas?

 FAIL  src/components/manage/Controlpanels/Rules/ConfigureRule.test.jsx (6.587 s)
  ConfigureRule
    ✕ renders rules configure interface (205 ms)

  ● ConfigureRule › renders rules configure interface

    TypeError: Cannot read properties of undefined (reading 'actions')

      644 |   connect(
      645 |     (state, props) => ({
    > 646 |       actions: state.actions.actions,
          |                              ^
      647 |       token: state.userSession.token,
      648 |       userId: state.userSession.token
      649 |         ? jwtDecode(state.userSession.token).sub

      at Function.Object.<anonymous>.exports.default.getTypes [as mapToProps] (src/components/manage/Toolbar/Toolbar.jsx:646:30)
      at mapToPropsProxy (../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/react-redux/lib/connect/wrapMapToProps.js:59:46)
      at Function.detectFactoryAndVerify (../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/react-redux/lib/connect/wrapMapToProps.js:68:19)
      at mapToPropsProxy (../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/react-redux/lib/connect/wrapMapToProps.js:59:46)
      at handleFirstCall (../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/react-redux/lib/connect/selectorFactory.js:30:18)
      at pureFinalPropsSelector (../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/react-redux/lib/connect/selectorFactory.js:71:81)
      at selector (../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/react-redux/lib/components/connect.js:340:18)
      at mountSyncExternalStore (../../node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:16799:20)
      at Object.useSyncExternalStore (../../node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:17727:14)
      at useSyncExternalStore (../../node_modules/.pnpm/[email protected]/node_modules/react/cjs/react.development.js:1676:21)
      at ConnectFunction (../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/react-redux/lib/components/connect.js:364:28)
      at renderWithHooks (../../node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:16305:18)
      at updateFunctionComponent (../../node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:19588:20)
      at updateSimpleMemoComponent (../../node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:19425:10)
      at updateMemoComponent (../../node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:19284:14)
      at beginWork (../../node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:21673:16)
      at beginWork$1 (../../node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:27426:14)
      at performUnitOfWork (../../node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:26560:12)
      at workLoopSync (../../node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:26466:5)
      at renderRootSync (../../node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:26434:7)
      at recoverFromConcurrentError (../../node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:25850:20)
      at performSyncWorkOnRoot (../../node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:26096:20)
      at flushSyncCallbacks (../../node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:12042:22)
      at commitRootImpl (../../node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:26959:3)
      at commitRoot (../../node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:26682:5)
      at finishConcurrentRender (../../node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:25981:9)
      at performConcurrentWorkOnRoot (../../node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:25809:7)
      at flushActQueue (../../node_modules/.pnpm/[email protected]/node_modules/react/cjs/react.development.js:2667:24)
      at act (../../node_modules/.pnpm/[email protected]/node_modules/react/cjs/react.development.js:2582:11)
      at ../../node_modules/.pnpm/@[email protected][email protected][email protected][email protected]/node_modules/@testing-library/react/dist/act-compat.js:46:25
      at renderRoot (../../node_modules/.pnpm/@[email protected][email protected][email protected][email protected]/node_modules/@testing-library/react/dist/pure.js:180:26)
      at render (../../node_modules/.pnpm/@[email protected][email protected][email protected][email protected]/node_modules/@testing-library/react/dist/pure.js:266:10)
      at Object.<anonymous> (src/components/manage/Controlpanels/Rules/ConfigureRule.test.jsx:22:33)

  console.error
    Error: Uncaught [TypeError: Cannot read properties of undefined (reading 'actions')]
        at reportException (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected]/node_modules/jsdom/lib/jsdom/living/helpers/runtime-script-errors.js:66:24)
        at innerInvokeEventListeners (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected]/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:341:9)
        at invokeEventListeners (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected]/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:274:3)
        at HTMLUnknownElementImpl._dispatch (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected]/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:221:9)
        at HTMLUnknownElementImpl.dispatchEvent (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected]/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:94:17)
        at HTMLUnknownElement.dispatchEvent (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected]/node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:231:34)
        at Object.invokeGuardedCallbackDev (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:4213:16)
        at invokeGuardedCallback (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:4277:31)
        at beginWork$1 (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:27451:7)
        at performUnitOfWork (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:26560:12)
        at workLoopSync (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:26466:5)
        at renderRootSync (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:26434:7)
        at performSyncWorkOnRoot (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:26085:20)
        at flushSyncCallbacks (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:12042:22)
        at commitRootImpl (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:26959:3)
        at commitRoot (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:26682:5)
        at finishConcurrentRender (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:25981:9)
        at performConcurrentWorkOnRoot (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:25809:7)
        at flushActQueue (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected]/node_modules/react/cjs/react.development.js:2667:24)
        at act (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected]/node_modules/react/cjs/react.development.js:2582:11)
        at /Users/user/projects/packages/volto/node_modules/.pnpm/@[email protected][email protected][email protected][email protected]/node_modules/@testing-library/react/dist/act-compat.js:46:25
        at renderRoot (/Users/user/projects/packages/volto/node_modules/.pnpm/@[email protected][email protected][email protected][email protected]/node_modules/@testing-library/react/dist/pure.js:180:26)
        at render (/Users/user/projects/packages/volto/node_modules/.pnpm/@[email protected][email protected][email protected][email protected]/node_modules/@testing-library/react/dist/pure.js:266:10)
        at Object.<anonymous> (/Users/user/projects/packages/volto/packages/volto/src/components/manage/Controlpanels/Rules/ConfigureRule.test.jsx:22:33)
        at Object.asyncJestTest (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected]/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:106:37)
        at /Users/user/projects/packages/volto/node_modules/.pnpm/[email protected]/node_modules/jest-jasmine2/build/queueRunner.js:45:12
        at new Promise (<anonymous>)
        at mapper (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected]/node_modules/jest-jasmine2/build/queueRunner.js:28:19)
        at /Users/user/projects/packages/volto/node_modules/.pnpm/[email protected]/node_modules/jest-jasmine2/build/queueRunner.js:75:41
        at processTicksAndRejections (node:internal/process/task_queues:95:5) TypeError: Cannot read properties of undefined (reading 'actions')
        at Function.Object.<anonymous>.exports.default.getTypes [as mapToProps] (/Users/user/projects/packages/volto/packages/volto/src/components/manage/Toolbar/Toolbar.jsx:646:30)
        at mapToPropsProxy (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/react-redux/lib/connect/wrapMapToProps.js:59:46)
        at Function.detectFactoryAndVerify (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/react-redux/lib/connect/wrapMapToProps.js:68:19)
        at mapToPropsProxy (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/react-redux/lib/connect/wrapMapToProps.js:59:46)
        at handleFirstCall (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/react-redux/lib/connect/selectorFactory.js:30:18)
        at pureFinalPropsSelector (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/react-redux/lib/connect/selectorFactory.js:71:81)
        at selector (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/react-redux/lib/components/connect.js:340:18)
        at mountSyncExternalStore (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:16799:20)
        at Object.useSyncExternalStore (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:17727:14)
        at useSyncExternalStore (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected]/node_modules/react/cjs/react.development.js:1676:21)
        at ConnectFunction (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/react-redux/lib/components/connect.js:364:28)
        at renderWithHooks (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:16305:18)
        at updateFunctionComponent (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:19588:20)
        at updateSimpleMemoComponent (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:19425:10)
        at updateMemoComponent (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:19284:14)
        at beginWork (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:21673:16)
        at HTMLUnknownElement.callCallback (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:4164:14)
        at HTMLUnknownElement.callTheUserObjectsOperation (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected]/node_modules/jsdom/lib/jsdom/living/generated/EventListener.js:26:30)
        at innerInvokeEventListeners (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected]/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:338:25)
        at invokeEventListeners (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected]/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:274:3)
        at HTMLUnknownElementImpl._dispatch (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected]/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:221:9)
        at HTMLUnknownElementImpl.dispatchEvent (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected]/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:94:17)
        at HTMLUnknownElement.dispatchEvent (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected]/node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:231:34)
        at Object.invokeGuardedCallbackDev (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:4213:16)
        at invokeGuardedCallback (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:4277:31)
        at beginWork$1 (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:27451:7)
        at performUnitOfWork (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:26560:12)
        at workLoopSync (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:26466:5)
        at renderRootSync (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:26434:7)
        at performSyncWorkOnRoot (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:26085:20)
        at flushSyncCallbacks (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:12042:22)
        at commitRootImpl (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:26959:3)
        at commitRoot (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:26682:5)
        at finishConcurrentRender (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:25981:9)
        at performConcurrentWorkOnRoot (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.development.js:25809:7)
        at flushActQueue (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected]/node_modules/react/cjs/react.development.js:2667:24)
        at act (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected]/node_modules/react/cjs/react.development.js:2582:11)
        at /Users/user/projects/packages/volto/node_modules/.pnpm/@[email protected][email protected][email protected][email protected]/node_modules/@testing-library/react/dist/act-compat.js:46:25
        at renderRoot (/Users/user/projects/packages/volto/node_modules/.pnpm/@[email protected][email protected][email protected][email protected]/node_modules/@testing-library/react/dist/pure.js:180:26)
        at render (/Users/user/projects/packages/volto/node_modules/.pnpm/@[email protected][email protected][email protected][email protected]/node_modules/@testing-library/react/dist/pure.js:266:10)
        at Object.<anonymous> (/Users/user/projects/packages/volto/packages/volto/src/components/manage/Controlpanels/Rules/ConfigureRule.test.jsx:22:33)
        at Object.asyncJestTest (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected]/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:106:37)
        at /Users/user/projects/packages/volto/node_modules/.pnpm/[email protected]/node_modules/jest-jasmine2/build/queueRunner.js:45:12
        at new Promise (<anonymous>)
        at mapper (/Users/user/projects/packages/volto/node_modules/.pnpm/[email protected]/node_modules/jest-jasmine2/build/queueRunner.js:28:19)
        at /Users/user/projects/packages/volto/node_modules/.pnpm/[email protected]/node_modules/jest-jasmine2/build/queueRunner.js:75:41
        at processTicksAndRejections (node:internal/process/task_queues:95:5)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants