You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have checked the open Issues to see if this has already been raised
I have searched the closed Issues to see if a similar bug has been fixed in the past
Description
This bug affects:
GitHub workflows
Component
Config
Performance
Tooling / Frameworks
Documentation
Something else
Steps to Reproduce
Have a project with date-fns 3.x installed
Install Canopy 11.14.1
Import and use beforeDateValidator or afterDateValidator on a form control with a null/undefined value. (i.e. make it so that control.value === null)
Run the app
Note it errors with TypeError: Cannot read properties of null (reading 'split') for parseISO
Expected behaviour:
Canopy should be using its own version of date-fns it relies on to run, when installed, and not the project's version of the dependency.
Actual behaviour:
Canopy uses the project's version of date-fns (3.x, in this case)
Recurrence frequency:
Occurs every time
Occurs intermittently
Unsure
Package version
This problem started happening recently
This problem started happening a while ago
Unsure
Configuration and environment
This pertains to local development
This pertains to the CI
This pertains to Storybook
Additional Information
I think the solution may be to move date-fns from peerDependencies in projects/canopy/package.json to dependencies.
Having tried this change locally, when running npm run build, I get this error/warning:
⚠ Distributing npm packages with 'dependencies' is not recommended. Please consider adding date-fns to 'peerDependencies' or remove it from 'dependencies'.
✖ Writing package manifest
Dependency date-fns must be explicitly allowed using the "allowedNonPeerDependencies" option.
The text was updated successfully, but these errors were encountered:
Prerequisites
Description
This bug affects:
Steps to Reproduce
date-fns
3.x installedbeforeDateValidator
orafterDateValidator
on a form control with anull
/undefined
value. (i.e. make it so thatcontrol.value
===null
)TypeError: Cannot read properties of null (reading 'split')
forparseISO
Expected behaviour:
Canopy should be using its own version of
date-fns
it relies on to run, when installed, and not the project's version of the dependency.Actual behaviour:
Canopy uses the project's version of
date-fns
(3.x, in this case)Recurrence frequency:
Package version
Configuration and environment
Additional Information
I think the solution may be to move
date-fns
frompeerDependencies
inprojects/canopy/package.json
todependencies
.Having tried this change locally, when running
npm run build
, I get this error/warning:The text was updated successfully, but these errors were encountered: