[BUG] - TypeError: Cannot destructure property 'ariaLabel' of DatePicker
HeroUI Version
@heroui/react: "2.7.5" , @heroui/date-picker: "^2.3.16"
Describe the bug
I have imported DateRangePicker from date-picker. and having error as Unhandled Runtime Error Error: Cannot destructure property 'ariaLabel' of '(0 , {imported module [project]/nodemodules/@heroui/date-input/nodemodules/@react-aria/datepicker/dist/useDateField.mjs [app-client] (ecmascript)}.hookData).get(...)' as it is undefined
Your Example Website or App
No response
Steps to Reproduce the Bug or Issue
- Try to run code
Expected behavior
not to have the error
Screenshots or Videos
No response
Operating System Version
Window
Browser
Chrome
Still having same issue. @wingkwong Can you please check once??
b4ff5547..js:2982 TypeError: Cannot destructure property 'ariaLabel' of '(0 , TURBOPACK__imported__module$5b$project$5d2f$node_modules$2f40$heroui$2f$date$2d$input$2f$node_modules$2f40$react$2d$aria$2f$datepicker$2f$dist$2f$useDateField$2e$mjs__$5b$app$2d$client$5d$$28$ecmascript$29$.hookData).get(...)' as it is undefined
I need to know all the dependencies and how you setup the project. Partial code won't help much. To speed up, please provide a sandbox instead where I could see the error directly and start investigating.
I am using Turborepo, and in one of the apps, I have integrated DateRangePicker from @hero-ui/date-picker.
Even after trying the following component, I am still encountering the same error:
It was working fine before but since I upgraded heroui/react to 2.7.5, I am having this issue.
I have attached the dependencies that I have used.
Hi, I recently updated my Next.js project to version 14.2.3 and migrated from NextUI to Hero UI using the codemod provided on the official website. After the update, the DateRangePicker component stopped working, throwing the same error as the op.
- Cannot destructure property 'ariaLabel' of '(0 , _useDateField_mjs...
Steps I took to troubleshoot the issue:
- Downgraded Hero UI to version 2.7.0, but the project started failing.
- Reverted to version 2.7.5, fixed linting issues, and the component started working again.
While everything seems to be working now, I will continue testing different parts of the app to ensure stability.
Environment:
- Next.js: v14.2.3
- Hero UI: v2.7.5
Hope it helps.
Hi Jonathan, I tried, but it didn’t work for me.
I downgraded Next.js to 14.2.3 and HeroUI to 2.7.0, but the issue persisted. Then, I upgraded everything to the latest versions, but the problem still remains.
Thank you @jonathanhirint for suggestion.
@Vivek1821 I couldn't further investigate without a sandbox. However, based on your package.json, I doubt it is due to the version mismatch. For example, you are using latest @heroui/react but there is some outdated individual packages. My suggestion is either just use the global one or all individual ones, with the latest version.
@wingkwong I followed your suggestions:
Removed individual packages and used a global installation, but the issue persists. Tried to reproduce the error on CodeSandbox, but it didn’t occur there. Matched the package versions in my project with CodeSandbox, but the issue still persists.
@Vivek1821 have you removed node_modules before installing?
Yes. node_modules , yarn.lock , cleared yarn cache , cleared turbo cache.
so same code works in sandbox but not in your local. would it be due to node / typescript version difference?
upgraded typescript to latest version, still it is giving same error.
any updates on this? I am facing the same issue
@Luisquii so far I couldn't reproduce. please provide a sandbox.
@Luisquii so far I couldn't reproduce. please provide a sandbox.
I downgraded to next ui-org, there was no easy solution.
I think you should try creating a project with next ui-org, add a date range picker and the try to update to heroui.
That was what I did and that broke my code.
I've got the same problem here just after migrating from nextUI to heroUI. I would say an almost smooth and perfect migration. Until this bug appears. I rollbacked for now and unfortunately, I have to remove Toast usages and others. Hope this will be solved asap. If it can help, this is my packages.json, before the migration.
{
"name": "cocohop-webapp",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev --experimental-https",
"dev-http": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@atlaskit/pragmatic-drag-and-drop": "^1.4.0",
"@atlaskit/pragmatic-drag-and-drop-flourish": "^1.1.2",
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.0.3",
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^1.1.3",
"@atlaskit/primitives": "^13.3.1",
"@atlaskit/tokens": "^2.4.0",
"@nextui-org/framer-transitions": "^2.0.15",
"@nextui-org/react": "^2.6.8",
"@nextui-org/shared-icons": "^2.1.1",
"@react-aria/i18n": "^3.12.4",
"@react-oauth/google": "^0.12.1",
"@react-stately/data": "^3.11.7",
"@react-types/datepicker": "^3.9.0",
"@react-types/shared": "^3.26.0",
"@rvf/react": "^6.2.1",
"@rvf/yup": "^6.0.3",
"@sentry/nextjs": "^8.55.0",
"@tanstack/react-query": "^5.59.15",
"@vercel/analytics": "^1.4.1",
"@vercel/speed-insights": "^1.1.0",
"algoliasearch": "^5.15.0",
"cookies-next": "^4.3.0",
"embla-carousel-react": "^8.5.1",
"framer-motion": "^11.11.9",
"google-libphonenumber": "^3.2.38",
"jwt-decode": "^4.0.0",
"next": "15.0.4",
"next-intl": "^3.26.0",
"npm": "^10.9.0",
"pdfjs-dist": "^4.8.69",
"react": "^18",
"react-apple-login": "^1.1.6",
"react-dom": "^18",
"react-instantsearch": "^7.13.8",
"react-international-phone": "^4.3.0",
"react-lottie-player": "^2.1.0",
"react-pdf": "^9.2.1",
"react-tabs-scrollable": "^2.0.7",
"tiny-invariant": "^1.3.3",
"typesense-instantsearch-adapter": "^2.8.0",
"uuid": "^11.1.0"
},
"devDependencies": {
"@tanstack/eslint-plugin-query": "^5.59.7",
"@types/google-libphonenumber": "^7.4.30",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"@types/react-facebook-login": "^4.1.11",
"eslint": "^8",
"eslint-config-next": "14.2.15",
"postcss": "^8",
"tailwindcss": "^3.4.1",
"typescript": "^5"
}
}
FYI I did the upgrade manually instead of automatically via codemod.
And everything works fine!
So I suggest investigations in the codemod script to detect what was done in addition to the manual migration. Also when I tested with codemod, I check yes for everything.
Thanks,
Any updates on this? I'm suddenly facing the same issue. Would migrating back to NextUI be necessary? That would be quite difficult for me, as I’ve made significant updates to my project. Reverting to a previous commit isn’t really an option at this point. Any guidance would be greatly appreciated. Thanks!
I was able to solve the issue by downgrading @heroui/date-picker (specifically as I installed the components I needed separately) to 2.3.9. But There were some combability issues on codes as I downgraded the package, But after fixing them (I needed to disable some eslint rules unfortunately and needed to use some bad practices), It works now, At least as temporary solution
I'm having the exact same problem. I didn't do the upgrade manually.