8 Commits

Author SHA1 Message Date
Andrew Clark 8a015b68cc Add deprecation warning for unmountComponentAtNode
This should have been deprecated in 18.0 alongside the other legacy
DOM APIs like render().
2024-04-25 12:22:01 -04:00
Andrew Clark c3b2839641 Add deprecation warning for findDOMNode
This is removed in version 19. We already warned inside of Strict Mode
but this adds the warning everywhere.
2024-04-25 12:22:01 -04:00
Andrew Clark d4ea75dc42 ReactDOMTestUtils deprecation warnings
Adds a deprecation warning to ReactDOMTestUtils.renderIntoDocument,
which is removed in version 19.

Also backports the deprecation warning for ReactDOMTestUtils.act.
2024-04-25 12:22:01 -04:00
Andrew Clark 415ee0e6ea Backport legacy context deprecation warning
This backports a deprecation warning for legacy context, even when
Strict Mode is not enabled.

I didn't bother to update all the tests because the tests are in such
a different state than what's on `main`, and on `main` we already
updated the tests accordingly. So instead I silenced the warnings in
our test config, like we've done for other warnings in the past.
2024-04-18 11:58:29 -04:00
Andrew Clark bd0a963445 Throw when act is used in production (#21686)
Upgrades the deprecation warning to a runtime error.

I did it this way instead of removing the export so the type is the same
in both builds. It will get dead code eliminated regardless.
2021-06-16 16:29:51 -04:00
Andrew Clark aecb3b6d11 Deprecate ReactDOM.render and ReactDOM.hydrate (#21652)
* Use existing test warning filter for server tests

We have a warning filter for our internal tests to ignore warnings
that are too noisy or that we haven't removed from our test suite yet:
shouldIgnoreConsoleError.

Many of our server rendering tests don't use this filter, though,
because it has its own special of asserting warnings.

So I added the warning filter to the server tests, too.

* Deprecate ReactDOM.render and ReactDOM.hydrate

These are no longer supported in React 18. They are replaced by the
`createRoot` API.

The warning includes a link to documentation of the new API. Currently
it redirects to the corresponding working group post. Here's the PR to
set up the redirect: https://github.com/reactjs/reactjs.org/pull/3730

Many of our tests still use ReactDOM.render. We will need to gradually
migrate them over to createRoot.

In the meantime, I added the warnings to our internal warning filter.
2021-06-09 13:46:55 -07:00
Sunil Pai a1dbb852c2 warn if you try to use act() in prod (#16282)
We have behaviour divergence for act() between prod and dev (specifically, act() + concurrent mode does not flush fallbacks in prod. This doesn't affect anyone in OSS yet)

We also don't have a good story for writing tests in prod (and what from what I gather, nobody really writes tests in prod mode).

We could have wiped out act() in prod builds, except that _we_ ourselves use act() for our tests when we run them in prod mode.

This PR is a compromise to all of this. We will log a warning if you try to use act() in prod mode, and we silence it in our test suites.
2019-08-05 13:01:05 -07:00
Dan Abramov b2adcfba32 Don't suppress jsdom error reporting in our tests (#13401)
* Don't suppress jsdom error reporting

* Address review
2018-08-15 17:44:46 +01:00