Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught TypeError: Cannot read property 'expirationTime' of undefined #14767

Closed
JDansercoer opened this issue Feb 6, 2019 · 9 comments
Closed

Uncaught TypeError: Cannot read property 'expirationTime' of undefined #14767

JDansercoer opened this issue Feb 6, 2019 · 9 comments

Comments

@JDansercoer
Copy link

@JDansercoer JDansercoer commented Feb 6, 2019

Do you want to request a feature or report a bug?

Bug

What is the current behavior?

App crashes

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.

This is currently my only component, copied from the docs

import React, { useState, useEffect } from 'react';

function Example() {
  const [count, setCount] = useState(0);

  // Similar to componentDidMount and componentDidUpdate:
  useEffect(() => {
    // Update the document title using the browser API
    document.title = `You clicked ${count} times`;
  });

  return (
    <div>
      <p>You clicked {count} times</p>
      <button onClick={() => setCount(count + 1)}>Click me</button>
    </div>
  );
}

export default Example;

However, my page crashes, and I get the following error

Uncaught TypeError: Cannot read property 'expirationTime' of undefined
    at processUpdateQueue (react-dom.development.js:15860)
    at mountClassInstance (react-dom.development.js:11353)
    at mountIndeterminateComponent (react-dom.development.js:14701)
    at beginWork (react-dom.development.js:15194)
    at performUnitOfWork (react-dom.development.js:18780)
    at workLoop (react-dom.development.js:18820)
    at HTMLUnknownElement.callCallback (react-dom.development.js:149)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:199)
    at invokeGuardedCallback (react-dom.development.js:256)
    at replayUnitOfWork (react-dom.development.js:18052)

Unfortunately, I cannot reproduce it in codesandbox, so not sure what exactly I might be doing wrong?

What is the expected behavior?

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
16.8.0 (React & ReactDOM)

@bvaughn
Copy link
Contributor

@bvaughn bvaughn commented Feb 6, 2019

I am also not able to reproduce this in Code Sandbox nor in a create-react-app, so I suspect your package versions maybe aren't what you think they are? Can you delete node_modules and re-install?

@bvaughn
Copy link
Contributor

@bvaughn bvaughn commented Feb 6, 2019

I am going to close this issue for now since I'm unable to reproduce it. I'll re-open if further discussion provides a repro 👍

@bvaughn bvaughn closed this Feb 6, 2019
@JDansercoer
Copy link
Author

@JDansercoer JDansercoer commented Feb 6, 2019

Yes, was about to close this as well, since I found the issue.

For further reference or people stumbling upon this, update your react-hot-loader.

Version 4.3.6 wasn't too fond of hooks apparently!

@ha404
Copy link
Contributor

@ha404 ha404 commented Mar 26, 2019

Apparently react-hot-loader's broken up to 4.5.2 as well, 4.8 worked 👍

@Ai01
Copy link

@Ai01 Ai01 commented Jun 19, 2019

image

in fact. this error because the update is undefined in react-dom.development.js. Someone find
the solution to this question?

l have already updated the react-hot-loader. it doesn't work because the react-loadable will also make this happen.

@himynameisdave
Copy link
Contributor

@himynameisdave himynameisdave commented Jun 19, 2019

I am seeing this issue and can reliably reproduce. My code is extremely similar to @JDansercoer's original post above ☝️ in that it's a function component which uses useState and useEffect. Updated all my dependencies (including the suggested react-hot-loader update suggested above) but nothing has resolved it.

Versions

  • react@16.8.6
  • react-dom@16.8.6
  • react-hot-loader@4.11.1
  • webpack@4.34.0
  • webpack-dev-server@3.7.2

Seeing the issue when running in Chrome 75.0.3770.100 on MacOS 10.14.5.


Still exploring the issue and will report back here if I find anymore details that would be helpful.

@bvaughn
Copy link
Contributor

@bvaughn bvaughn commented Jun 19, 2019

Share an actual (runnable) repro? Preferably a pointer to a Code Sandbox project. Alternatively a git repo.

@himynameisdave
Copy link
Contributor

@himynameisdave himynameisdave commented Jun 19, 2019

@bvaughn so I've resolved the issue by using this patched version of react-dom. I guess Hooks aren't really well supported by react-hot-loader (?) so this gets us around the issue.

In any case this isn't an problem with react so this issue needn't be reopened here. 👍

@gsaandy
Copy link

@gsaandy gsaandy commented Jun 28, 2019

I'm getting the same issue with https://docz.site and create react app 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
7 participants
@bvaughn @ha404 @gsaandy @himynameisdave @JDansercoer @Ai01 and others