ericz1803 / react-google-calendar

React Calendar Component that displays data from Google Calendar
https://ericz1803.github.io/react-test-calendar
MIT License
176 stars 63 forks source link

TypeError: Cannot read properties of null (reading 'registered') #60

Closed Kicsu closed 6 months ago

Kicsu commented 9 months ago

Hi Eric!

I would like to integrate my calendar into my app and I would like to use your solution, but I have a problem. When I run the application for the first time it works fine but after a refresh a nd later on, I got the following issue:

warn - ./node_modules/@ericz1803/react-google-calendar/dist/react-google-calendar.es.js Module not found: Can't resolve './locale' in 'C:\git\MyRepo\node_modules\@ericz1803\react-google-calendar\dist'

TypeError: Cannot read properties of null (reading 'registered') at C:\git\MyRepo\node_modules\@ericz1803\react-google-calendar\dist\react-google-calendar.umd.js:53:954 at C:\git\MyRepo\node_modules\@ericz1803\react-google-calendar\dist\react-google-calendar.umd.js:52:2177 at renderWithHooks (C:\git\MyRepo\node_modules\react-dom\cjs\react-dom-server.browser.development.js:5658:16) at renderForwardRef (C:\git\MyRepo\node_modules\react-dom\cjs\react-dom-server.browser.development.js:5842:18) at renderElement (C:\git\MyRepo\node_modules\react-dom\cjs\react-dom-server.browser.development.js:6005:11) at renderNodeDestructiveImpl (C:\git\MyRepo\node_modules\react-dom\cjs\react-dom-server.browser.development.js:6104:11) at renderNodeDestructive (C:\git\MyRepo\node_modules\react-dom\cjs\react-dom-server.browser.development.js:6076:14) at finishClassComponent (C:\git\MyRepo\node_modules\react-dom\cjs\react-dom-server.browser.development.js:5688:3) at renderClassComponent (C:\git\MyRepo\node_modules\react-dom\cjs\react-dom-server.browser.development.js:5696:3) at renderElement (C:\git\MyRepo\node_modules\react-dom\cjs\react-dom-server.browser.development.js:5943:7)

Do you have any idea whats the problem?

This is my packet.json dependencies: "dependencies": { "@emotion/react": "^11.11.1", "@ericz1803/react-google-calendar": "^4.3.1", "@material-ui/core": "4.11.4", "@material-ui/icons": "^4.11.3", "classnames": "2.3.2", "moment": "2.29.4", "next": "12.2.5", "nouislider": "14.7.0", "prop-types": "15.8.1", "react": "^18.2.0", "react-datetime": "3.1.1", "react-dom": "^18.2.0", "react-slick": "0.29.0", "sass": "1.66.1", "styled-components": "5.3.5", "webpack": "5.88.2" }

dmitrydnch commented 9 months ago

This worked for me: try to create loaded state and change it to true when a component is rendered using useEffect.

function YourComponent() {
    const [loaded, setLoaded] = useState(false);

    useEffect(() => {
        setLoaded(true);
    }, []);

    if(!loaded) return <div>loading...</div>

    return (
      <div>
          {loaded && <Calendar/>}
      </div>
    )
}
UnaWebSolutions commented 9 months ago

@dmitrydnch have you have able to get the tooltip to work for you. if so, how did you implement thru code or is it supposed to work automatically when an event is clicked. Thanks for any help on this time-sensitive issue im having

ericz1803 commented 6 months ago

Just fixed the build process in v4.3.2 which should fix this issue.

goanpeca commented 4 months ago

@ericz1803 I am still experiencing the issue reported here. Any pointers of what could be done to help :) ?

Cheers and thanks for the project!

goanpeca commented 4 months ago

Would it be possible to turn this component into a SSR, I could help if provided with some pointers :)

Cheers!