Skip to content
This repository was archived by the owner on Dec 31, 2020. It is now read-only.

Revert "Add test for proper reaction disposal in StrictMode"#145

Merged
danielkcz merged 1 commit intomasterfrom
revert-119-master
May 1, 2019
Merged

Revert "Add test for proper reaction disposal in StrictMode"#145
danielkcz merged 1 commit intomasterfrom
revert-119-master

Conversation

@danielkcz
Copy link
Copy Markdown
Collaborator

Reverts #119

This was surpassed by #121 and should not have been released. It's actually possible it is a culprit of #143 even though current tests are passing.

@RoystonS I think you said you had some problems with this change, right? So it's probably better to get rid of it altogether.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.005%) to 98.974% when pulling 991165a on revert-119-master into cf5b97a on master.

@RoystonS
Copy link
Copy Markdown
Contributor

RoystonS commented May 1, 2019

#119 by itself was problematic, but #121 was based on #119

@RoystonS
Copy link
Copy Markdown
Contributor

RoystonS commented May 1, 2019

(It would be good to have some failing tests for #143)


useDebugValue(reaction, printDebugValue)

useEffect(() => {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing this useEffect hook to useLayoutEffect fixes the bug for me.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We certainly don't want to useLayoutEffect, that's bad for karma and stuff :) Besides, you said this PR alone fixed it, so I am not sure why would modify it even further. Please do provide an example, this is really hard to understand what kind of issue it actually is.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ha, yeah, makes sense. Out of curiosity, what’s the reason that committed.current is set asynchronously in the useEffect hook rather than synchronously in the body of the useObserver hook?

Copy link
Copy Markdown

@meyer meyer May 1, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving committed.current = true; up and out of the useEffect hook also fixes the bug I was encountering.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't worry about this. It was really just an early experiment. See #121 for a proper solution and some details.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rad, thanks 🎉

@danielkcz danielkcz merged commit 36657cc into master May 1, 2019
@danielkcz danielkcz deleted the revert-119-master branch May 1, 2019 21:11
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants