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

Original error message is swallowed in an edge case with render phase updates #14674

Closed
gaearon opened this Issue Jan 23, 2019 · 5 comments

Comments

Projects
None yet
3 participants
@gaearon
Copy link
Member

commented Jan 23, 2019

"Cannot set property 'memoizedState' of null"

screen shot 2019-01-23 at 5 09 40 pm

  // Regression test
  fit('does not swallow original error when updating another component in render phase', () => {
    let {useState} = React;

    let _setState;
    function A() {
      const [, setState] = useState(0);
      _setState = setState;
      return null;
    }

    function B() {
      _setState(() => {
        throw new Error('Hello')
      });
    }

    expect(() =>
      ReactTestRenderer.create(
        <React.Fragment>
          <A />
          <B />
        </React.Fragment>,
      ),
    ).toThrow('Hello');
  });

gaearon added a commit to gaearon/react that referenced this issue Jan 23, 2019

@klymenkoo

This comment has been minimized.

Copy link

commented Jan 23, 2019

I'd like to work on this issue if you don't mind.

@gaearon

This comment has been minimized.

Copy link
Member Author

commented Jan 23, 2019

I won't promise we won't fix it sooner — but if you can find the cause, it would be appreciated

@gaearon

This comment has been minimized.

Copy link
Member Author

commented Jan 23, 2019

I found a fix but thanks for the offer.

@joshuaaguilar20

This comment has been minimized.

Copy link

commented Jan 23, 2019

@gaearon just curious did you find the cause?

@gaearon

This comment has been minimized.

Copy link
Member Author

commented Feb 8, 2019

Yes I fixed it

@gaearon gaearon closed this Feb 8, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.