payload icon indicating copy to clipboard operation
payload copied to clipboard

TypeError: Cannot read properties of undefined (reading 'confirm-reindex-modal')

Open cbratschi opened this issue 1 year ago • 3 comments

Describe the Bug

Error while opening the search collection in the admin panel:

Error: Cannot read properties of undefined (reading 'confirm-reindex-modal') 3351752589
Request: /admin/collections/search?limit=10 GET
Context: App Router /admin/[[...segments]] render server-rendering undefined
Runtime: nodejs
 ⨯ [TypeError: Cannot read properties of undefined (reading 'confirm-reindex-modal')] {
  digest: '3351752589'
}

Happens while server-rendering this component.

Unfortunately not much details in the stack trace:

The above error occurred in the <eval> component. It was handled by the <ReactDevOverlay> error boundary. Error Component Stack
    at eval (index.js:3157:17)
    at ReindexConfirmModal (index.js:14:3)
    at div (<anonymous>)
    at ReindexButtonClient (index.client.js:27:34)

Link to the code that reproduces this issue

https://github.com/cbratschi/payload

Reproduction Steps

Use the search plugin. Open the search collection admin page. Error occurs while loading.

Which area(s) are affected? (Select all that apply)

plugin: search

Environment Info

Binaries:
  Node: 22.9.0
  npm: 10.8.3
  Yarn: 1.22.22
  pnpm: N/A
Relevant Packages:
  payload: 3.6.0
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.1.0: Thu Oct 10 21:05:23 PDT 2024; root:xnu-11215.41.3~2/RELEASE_ARM64_T6031
  Available memory (MB): 65536
  Available CPU cores: 16

cbratschi avatar Dec 18 '24 10:12 cbratschi

Hey @cbratschi, I'll look into this one too. Strange as your error message seems to be about the reindex modal slug passed to the modal hook. I did not notice this error in 3.6.0, but maybe try latest in the meantime?

akhrarovsaid avatar Dec 18 '24 20:12 akhrarovsaid

Hey @cbratschi,

Just following up on this as promised! I can't reproduce this issue and haven't seen an instance of it since reindexing was introduced. As I mentioned above, the error you're seeing is related to the slug of the reindex modal so I'm thinking it might have something to do with the ui package modals. My recommendation would be to update to the latest or try reinstalling deps.

I tested against the monorepo using both mongodb and postgres. If you're still seeing this issue, then it'd be nice if I could see a valid repro or some more details about your environment.

akhrarovsaid avatar Dec 19 '24 07:12 akhrarovsaid

Hello @akhrarovsaid,

Please can you share how you were able to run through the issue, and how you arrived at your solution. I am new to open-source contribution, and I found out about this issue on Tublian. Can you please enlighten me in anyway, I am willing to learn.

EmmanuelAjibokun avatar Dec 19 '24 18:12 EmmanuelAjibokun

It works now fine with Payload 3.12.0.

cbratschi avatar Dec 30 '24 14:12 cbratschi

This issue has been automatically locked. Please open a new issue if this issue persists with any additional detail.

github-actions[bot] avatar Jan 01 '25 04:01 github-actions[bot]