Closed usmanmaqbool636 closed 1 month ago
node_modules/@ai-stack/payloadcms/dist/ui/Compose/hooks/useHistory.js
I was able to resolve the issue by adding the optional chaining operator id?.toString() in the following block of code from useHistory.js:
Object.keys(latestHistory).forEach((k)=>{
if (!k.startsWith(id?.toString())) {
delete latestHistory[k];
}
});
Hi @usmanmaqbool636! Thanks for reporting, would you like to submit a PR?
sure
Hey @ashbuilds , I’ve created the PR. Please take a look when you get a chance https://github.com/ashbuilds/payload-ai/pull/52
3.0.0-beta.111
I encountered a TypeError while using Payload CMS version 3.0.0-beta.111. The error appears in the useHistory.js hook, specifically when calling toString on an undefined property.
TypeError: Cannot read properties of undefined (reading 'toString') at eval (webpack-internal:///(app-pages-browser)/./node_modules/.pnpm/@ai-stack+payloadcms@3.0.0-beta.111_kbmvfilg3g3w6q46teqh3p4tfu/node_modules/@ai-stack/payloadcms/dist/ui/Compose/hooks/useHistory.js:44:34) at Array.forEach (<anonymous>) at eval (webpack-internal:///(app-pages-browser)/./node_modules/.pnpm/@ai-stack+payloadcms@3.0.0-beta.111_kbmvfilg3g3w6q46teqh3p4tfu/node_modules/@ai-stack/payloadcms/dist/ui/Compose/hooks/useHistory.js:43:36) at eval (webpack-internal:///(app-pages-browser)/./node_modules/.pnpm/@ai-stack+payloadcms@3.0.0-beta.111_kbmvfilg3g3w6q46teqh3p4tfu/node_modules/@ai-stack/payloadcms/dist/ui/Compose/hooks/useHistory.js:57:9) at react-stack-bottom-frame (webpack-internal:///(app-pages-browser)/./node_modules/.pnpm/next@15.0.0-canary.186_@opentelemetry+api@1.9.0_react-dom@19.0.0-rc-3edc000d-20240926_react@1_eik4yb4jmqrehd77rh7hgfk6nu/node_modules/next/dist/compiled/react-dom/cjs/react-dom-client.development.js:22442:20)
posts.ts (collection)