Skip to content

Commit 5297fae

Browse files
authored
Merge pull request #1128 from japgolly/finish_react_18
2 parents 6630865 + 8610536 commit 5297fae

File tree

85 files changed

+1312
-434
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+1312
-434
lines changed

doc/CONFIG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* Runtime Settings *(development-mode only)*
1010
* [Usage](#runtime-settings-usage)
1111
* [`Reusability.disableGloballyInDev()`](#reusabilitydisablegloballyindev)
12-
* [`ReusabilityOverlay.overrideGloballyInDev()`](#reusabilityoverlayoverridegloballyindev)
12+
* ~~[`ReusabilityOverlay.overrideGloballyInDev()`](#reusabilityoverlayoverridegloballyindev)~~
1313
* [Custom `ReusabilityOverride`](#custom-reusabilityoverride)
1414

1515

@@ -211,6 +211,8 @@ This globally disables `Reusability.shouldComponentUpdate` so that it doesn't no
211211

212212
# `ReusabilityOverlay.overrideGloballyInDev()`
213213

214+
**[ReusabilityOverlay has been deprecated in v3 with no replacement — use React's Profiler instead]**
215+
214216
*Note: Runtime settings only affect development-mode (`fastOptJS`) and must be applied before any components are created.*
215217

216218
This makes calls to `Reusability.shouldComponentUpdate` also display a little UI overlay for you to inspect/debug

doc/PERFORMANCE.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,14 +179,16 @@ If you used it to derive an instance for `case class Person(id: Int, name: Strin
179179

180180
There exist two mixins, out-of-the-box, to help you monitor reusability. Use them instead of `shouldComponentUpdate`.
181181

182-
1. `ReusabilityOverlay.install` - Adds an overlay beside each mounted instance of the component, showing how many updates were prevented and how many were rendered. You can hover over it for some detail, and click it to print more to the JS console. [Live demo](https://japgolly.github.io/scalajs-react/#examples/reusability).
182+
1. **[Deprecated in v3 with no replacement — use React's Profiler instead]**
183+
~~`ReusabilityOverlay.install` - Adds an overlay beside each mounted instance of the component, showing how many updates were prevented and how many were rendered. You can hover over it for some detail, and click it to print more to the JS console. [Live demo](https://japgolly.github.io/scalajs-react/#examples/reusability).~~
183184
2. `shouldComponentUpdateAndLog` - Logs each callback evaluation to the console.
184185

185186
Usage:
186187
```scala
187188
// No monitoring
188189
.configure(Reusability.shouldComponentUpdate)
189190

191+
// DEPRECATED IN V3 WITH NO REPLACEMENT
190192
// Display stats on screen, clickable for detail
191193
.configure(ReusabilityOverlay.install)
192194

doc/changelog/3.0.0.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,17 @@
3838
- The ability to globally turn React warnings into errors via sbt system properties has been removed.
3939
It's test case had an error in it — it never worked as intended.
4040

41+
- `TriStateCheckbox` no longer uses `Reusability.shouldComponentUpdate`, therefore
42+
the fourth argument to its props is no longer wrapped in `Reusable`.
43+
4144
### Deprecated
4245

4346
- Anything deprecated by React 18 is now deprecated in Scala
4447

4548
- `.renderBackend` — see https://github.com/japgolly/scalajs-react/pull/1125 for how to replace it
4649

50+
- `ReusabilityOverlay` is now deprecated without replacement. It relied on `ReactDOM.findDOMNode` which has been removed in React 19.
51+
4752
- `ReactTestUtils` is now `LegacyReactTestUtils` and deprecated
4853

4954
### Upgrades

library/build.sbt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ val ghpagesMacros = ScalaJsReact.ghpagesMacros
2323
val root = ScalaJsReact.root
2424
val scalafixRules = ScalaJsReact.scalafixRules
2525
val tests = ScalaJsReact.tests
26+
val testsDep = ScalaJsReact.testsDep
2627
val testUtilMacros = ScalaJsReact.testUtilMacros
2728
val testUtil = ScalaJsReact.testUtil
2829
val util = ScalaJsReact.util

library/coreGeneric/src/main/scala/japgolly/scalajs/react/ComponentDom.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ object ComponentDom {
4848
case null | () => Unmounted
4949
}
5050

51+
@deprecated("findDOMNode is deprecated and will be removed in the next major release. Instead, add a ref directly to the element you want to reference.", "3.0.0 / React v18")
5152
def findDOMNode(a: dom.Element | facade.React.ComponentUntyped): ComponentDom = {
5253
val b: facade.ReactDOM.DomNode | Null =
5354
try facade.ReactDOM.findDOMNode(a)

library/coreGeneric/src/main/scala/japgolly/scalajs/react/ReactDOM.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ object ReactDOM {
1010
@inline def version = facade.ReactDOM.version
1111

1212
/** For mounted components, use .getDOMNode */
13+
@deprecated("findDOMNode is deprecated and will be removed in the next major release. Instead, add a ref directly to the element you want to reference.", "3.0.0 / React v18")
1314
def findDOMNode(componentOrElement: dom.Element | facade.React.ComponentUntyped): Option[ComponentDom.Mounted] =
1415
ComponentDom.findDOMNode(componentOrElement).mounted
1516

library/coreGeneric/src/main/scala/japgolly/scalajs/react/Reusability.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,8 @@ object Reusability extends ReusabilityMacros with ScalaVersionSpecificReusabilit
509509
def currentState = self.currentState
510510
def nextProps = self.nextProps
511511
def nextState = self.nextState
512+
513+
@deprecated("Add a ref directly to the element you want to reference.", "3.0.0")
512514
def getDOMNode = self.getDOMNode
513515

514516
val updateProps: Boolean = currentProps ~/~ nextProps

library/coreGeneric/src/main/scala/japgolly/scalajs/react/component/Generic.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,9 @@ object Generic {
135135
type WithMappedProps[P2] <: MountedSimple[F, A, P2, S]
136136
def mapProps[P2](f: P => P2): WithMappedProps[P2]
137137

138+
@deprecated("Add a ref directly to the element you want to reference.", "3.0.0")
138139
def getDOMNode: F[ComponentDom]
140+
139141
def props: F[Props]
140142
def propsChildren: F[PropsChildren]
141143

library/coreGeneric/src/main/scala/japgolly/scalajs/react/component/Js.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ object Js extends JsBaseComponentTemplate[facade.React.ComponentClassP] {
139139
override def props = raw.props
140140
override def propsChildren = PropsChildren.fromRawProps(raw.props)
141141
override def state = raw.state
142+
143+
@deprecated("Add a ref directly to the element you want to reference.", "3.0.0")
142144
override def getDOMNode = ComponentDom.findDOMNode(raw)
143145

144146
override def setState[G[_]](state: S, callback: => G[Unit])(implicit G: Dispatch[G]): Unit =

library/coreGeneric/src/main/scala/japgolly/scalajs/react/component/Scala.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ object Scala {
8181
override def props = x.props.unbox
8282
override def propsChildren = x.propsChildren
8383
override def state = x.state.unbox
84+
85+
@deprecated("Add a ref directly to the element you want to reference.", "3.0.0")
8486
override def getDOMNode = x.getDOMNode
8587

8688
override def setState[G[_]](newState: S, callback: => G[Unit])(implicit G: Dispatch[G]) =

0 commit comments

Comments
 (0)