Skip to content

[Fiber] Mount/unmount warnings and invariants - #8919

Merged
acdlite merged 7 commits into
react:masterfrom
acdlite:fibermounttests
Feb 7, 2017
Merged

acdlite merged 7 commits into
react:masterfrom
acdlite:fibermounttests

Conversation

@acdlite

@acdlite acdlite commented Feb 2, 2017

Copy link
Copy Markdown
Collaborator

Fixes some of the tests in ReactMount-test.js, except the ones related to server-side rendering.

Comment thread scripts/fiber/tests-failing.txt Outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why have they moved to failed?

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.

Just noticed that, not sure why

@acdlite

acdlite commented Feb 2, 2017

Copy link
Copy Markdown
Collaborator Author

@gaearon Ok fixed it

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can you verify the logic here? This means if you call render on a container with existing React children created by another React, we don't warn? I guess that is consistent with before.

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.

Yeah we currently only warn about different copies of React on unmount

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why the change here?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hm. This looks wrong. This changes the behavior we're testing. Why doesn't it work?

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Specifically we want to test that we can render into the node we already rendered.

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.

It does work the old way but it warns. Stack doesn't warn but it seems like it should?

Why doesn't Stack warn?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It's allowed to render into an empty element. This test intentionally tests that so your change messes that up.

@acdlite

acdlite commented Feb 6, 2017

Copy link
Copy Markdown
Collaborator Author

@spicyj Fixed

' This may be caused by unintentionally loading two independent ' +
'copies of React.' :
''
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do these strings get compressed? Would it be better if we split them into separate invariants?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It would be nice if error code transform was throwing on anything other than static messages.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@gaearon: It does; this is a %s param so you can put whatever you want there.

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.

Yeah, I copy and pasted this from Stack. I'll change it in both places to use multiple invariants instead.

That way the messages are extracted by the error code transform.
@acdlite
acdlite merged commit 5cfff87 into react:master Feb 7, 2017
mrizwanashiq pushed a commit to mrizwanashiq/react that referenced this pull request Jun 25, 2026
[Fiber] Mount/unmount warnings and invariants
hanzo-dev pushed a commit to hanzoai/react that referenced this pull request Sep 9, 2026
[Fiber] Mount/unmount warnings and invariants
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants