premieroctet / next-admin

▲ Full-featured admin for Next.js and Prisma
https://next-admin.js.org
MIT License
321 stars 19 forks source link

[BUG] - Cannot read properties of undefined (reading 'length') #465

Closed ksaitor closed 1 month ago

ksaitor commented 1 month ago

Description

Screenshot 2024-10-04 at 09 43 50

Reproduction URL

n/a

Reproduction steps

1. Some of the prisma model pages throw this error

Next router

Page router

Next Admin version

6.1.4

Screenshots

No response

Next Admin options

initial clean setup. no custom options

Logs

⨯ TypeError: Cannot read properties of undefined (reading 'length')
    at eval (webpack-internal:///./node_modules/@premieroctet/next-admin/dist/utils/server.js:357:52)
    at Array.forEach (<anonymous>)
    at findRelationInData (webpack-internal:///./node_modules/@premieroctet/next-admin/dist/utils/server.js:346:72)
    at mapDataList (webpack-internal:///./node_modules/@premieroctet/next-admin/dist/utils/prisma.js:312:77)
    at getMappedDataList (webpack-internal:///./node_modules/@premieroctet/next-admin/dist/utils/prisma.js:368:15)
    at async getPropsFromParams (webpack-internal:///./node_modules/@premieroctet/next-admin/dist/utils/props.js:88:48)
    at async getNextAdminProps (webpack-internal:///./node_modules/@premieroctet/next-admin/dist/pageRouter.js:17:19)
    at async eval (webpack-internal:///./pages/admin/[[...nextadmin]].tsx:37:12)
    at async withSuperJSON (file:///Users/.../node_modules/next-superjson-plugin/dist/tools.js:7:24)
    at async e8 (/Users/.../node_modules/next/dist/compiled/next-server/pages.runtime.dev.js:25:124)
    at async doRender (/Users/.../node_modules/next/dist/server/base-server.js:1407:30)
    at async cacheEntry.responseCache.get.routeKind (/Users/.../node_modules/next/dist/server/base-server.js:1581:28)
    at async DevServer.renderToResponseWithComponentsImpl (/Users/.../node_modules/next/dist/server/base-server.js:1489:28)
    at async DevServer.renderPageComponent (/Users/.../node_modules/next/dist/server/base-server.js:1913:24)
    at async DevServer.renderToResponseImpl (/Users/.../node_modules/next/dist/server/base-server.js:1951:32) {
  page: '/admin/article'
}


### Browsers

_No response_
foyarash commented 1 month ago

Hello @ksaitor , thanks for the report. Can you please let us know if this issue is fixed with v6.1.5 ?

If not, could you please send the following:

Thank you !

ksaitor commented 1 month ago

wow! it worked. thanks @foyarash 🚀

p.s. finally a working admin panel for prisma and next. Will be integrating it more and providing feedback 🚀