Solution for "Cannot read property 'isHiddenDay' of undefined"
See original GitHub issueThe JS error Cannot read property 'isHiddenDay' of undefined
happens when there are multiple instances of the @fullcalendar/common
package present in the same build. This is not the fault of the end-developer. After all, @fullcalendar/common
is an internal-only package that nobody explicitly installs themselves.
How to solve this?: guarantee that all plugins are using the same @fullcalendar/common
package by having @fullcalendar/core
(the package the requires common) always be a peerDependency
. It is already a peerDependency
for all packages except the following:
@fullcalendar/react
@fullcalendar/angular
@fullcalendar/vue
Right now, things usually work because most bundlers know to dedup references to the same packages with similar semver strings. However, sometimes the semver strings are not exact. For example ^5.7.0
and ^5.7.1
. This frequently happens when we release a patch-level release for only one package, not all. When this happens, bundlers act unpredictably with how they dedup. Using a peerDependency sidesteps this unpredictability.
This will be a breaking change for those three packages. That is why I will wait until v6 to implement this. For the remaining releases of v5, I will avoid the problem by making sure that all packages are always published upon any version bump.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:10
- Comments:12 (2 by maintainers)
Top GitHub Comments
So here’s how I seem to have fixed it with Next.js. I had the basic React example with
react@5.11.2
anddaygrid@5.11.3
packages installed. They seemed to import global css files, which didn’t sit well with Next. I found some fix involvingnext-transpile-modules
. Runningnpm ls @fullcalendar/common
indicated that there were no problems with deduping. Here’s what I did:@fullcalendar/react@beta
and@fullcalendar/daygrid@beta
next-transpile-modules
from mynext.config.js
I’m quite unfamiliar with Next, so I have no idea why this works, but I won’t complain.
@vhscom Thank you; I’ll have a look at that this week.