Skip to content

Commit 31eace0

Browse files
committed
Review and tweaks
1 parent be97347 commit 31eace0

File tree

12 files changed

+28
-136
lines changed

12 files changed

+28
-136
lines changed

coreBundleCBIO/src/main/scala/japgolly/scalajs/react/internal/ReactCallbackExtensions.scala

Lines changed: 0 additions & 111 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../../../../coreBundleCallback/src/main/scala/japgolly/scalajs/react/internal/ReactCallbackExtensions.scala

coreBundleCBIO/src/main/scala/japgolly/scalajs/react/package.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ import japgolly.scalajs.react.util.DefaultEffects._
55
package object react
66
extends japgolly.scalajs.react.internal.CoreGeneralF[Sync]
77
with japgolly.scalajs.react.internal.ReactCallbackExtensions
8-
with japgolly.scalajs.react.ReactCats
9-
with japgolly.scalajs.react.callback.Exports
8+
with japgolly.scalajs.react.callback.Exports
9+
with japgolly.scalajs.react.ReactCats

coreBundleCBIO/src/main/scala/japgolly/scalajs/react/util/DefaultEffectsCBIO.scala

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import japgolly.scalajs.react.callback._
77

88
sealed trait DefaultEffectsLowPri extends DefaultEffectsApiLowPri {
99
override final type Async[A] = IO[A]
10-
1110
@inline override final implicit lazy val Async: EffectCatsEffect.io.type = EffectCatsEffect.io
1211
}
1312

@@ -19,6 +18,6 @@ object DefaultEffects extends DefaultEffectsLowPri with DefaultEffectsApi {
1918
// Effect highest-priority
2019

2120
abstract class EffectFallbacks extends EffectFallbacks1 {
22-
override implicit def callback : Effect.Sync [CallbackTo] = EffectCallback.callback
23-
override implicit def io : Effect.Async[IO ] = EffectCatsEffect.io
21+
override implicit def callback: Effect.Sync [CallbackTo] = EffectCallback.callback
22+
override implicit def io : Effect.Async[IO ] = EffectCatsEffect.io
2423
}

coreExtCatsEffect/src/main/scala/japgolly/scalajs/react/util/EffectCatsEffect.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ object EffectCatsEffect {
3939

4040
// ===================================================================================================================
4141

42-
implicit lazy val io: AsyncIO = new AsyncIO(ReactCatsEffect.runtimeFn)
42+
implicit lazy val io: AsyncIO =
43+
new AsyncIO(ReactCatsEffect.runtimeFn)
4344

4445
class AsyncIO(runtime: () => IORuntime) extends Async.WithDefaults[IO] {
4546

coreGeneric/src/main/scala/japgolly/scalajs/react/component/ScalaFn.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ package japgolly.scalajs.react.component
33
import japgolly.scalajs.react.hooks.HookComponentBuilder
44
import japgolly.scalajs.react.internal._
55
import japgolly.scalajs.react.vdom.VdomNode
6-
import japgolly.scalajs.react.{Children, CtorType, PropsChildren, facade}
6+
import japgolly.scalajs.react.{Children, CtorType, PropsChildren, Reusability, facade}
77
import scala.scalajs.js
8-
import japgolly.scalajs.react.Reusability
98

109
object ScalaFn {
1110

doc/MODULES.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ with the opt-in optional features shown for you to accept or remove.
1515
Add to sbt:
1616

1717
```scala
18-
val ScalaJsReactVer = "2.0.0-RC3"
18+
val ScalaJsReactVer = "<latest>"
1919

2020
libraryDependencies ++= Seq(
2121

@@ -118,7 +118,7 @@ These are all the modules meant for end-user selection.
118118
| `callback-ext-cats_effect` | For classes in the `callback` module: <ul><li>`cats.effect.{Sync,Async}` instances</li><li>Conversions from/to `cats.effect.{SyncIO,IO}`</li></ul> |
119119
| `core` | Core scalajs-react functionality with `{Callback,AsyncCallback}` as the default effects |
120120
| `core-bundle-cats_effect` | Core scalajs-react functionality with `cats.effect.{SyncIO,IO}` as the default effects<br>*(Note: `callback` module not included. Add as a separate dependency if required.)* |
121-
| `core-bundle-cb_io` | Core scalajs-react functionality with `Callback` as the default sync effect and `cats.effect.IO` as the default async effect.<br>*(Note: both `callback` and `core-ext-cats_effect` modules are included.* |
121+
| `core-bundle-cb_io` | Core scalajs-react functionality with `Callback` as the default sync effect and `cats.effect.IO` as the default async effect.<br>*(Note: both `callback` and `core-ext-cats_effect` modules are included.)* |
122122
| `core-ext-cats` | Extensions to the `core` module for Cats |
123123
| `core-ext-cats_effect` | Extensions to the `core` module for Cats Effect |
124124
| `extra` | Optional utils exclusive to scalajs-react. ([details](./EXTRA.md)) |

doc/changelog/2.0.0.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,10 @@ You can run the script in the Migration section at the bottom of the page to aut
374374
* UnivEq to 2.0.0
375375
376376
377+
# Changes in RC5
378+
* Add a new bundle called `core-bundle-cb_io` with provides core scalajs-react functionality with `Callback` as the default sync effect and `cats.effect.IO` as the default async effect. (Thanks [@rpiaggio](https://github.com/rpiaggio))
379+
380+
s
377381
# Thanks
378382
379383
A lot of this was kindly sponsored by [Gemini](https://www.gemini.edu/)/[NOIRLab](https://nationalastro.org/)/[AURA](https://www.aura-astronomy.org/).

downstream-tests/js-cbio/src/main/scala/downstream/Catnip.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ object Catnip {
2222
val Component = ScalaComponent.builder[String]
2323
.initialState(0)
2424
.renderBackend[Backend]
25-
.componentDidMount($ => $.backend.onMount2)
25+
.componentDidMount(_.backend.onMount)
26+
.componentDidMount(_.backend.onMount2)
2627
.build
2728
}

downstream-tests/js-cbio/src/test/scala/downstream/CBIOBundleTests.scala

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
package downstream
22

3+
import concurrent.ExecutionContext.Implicits.global
34
import japgolly.microlibs.testutil.TestUtil._
45
import japgolly.scalajs.react.test.ReactTestUtils._
5-
import utest._
66
import scala.concurrent.Future
77
import scala.concurrent.Promise
8-
import concurrent.ExecutionContext.Implicits.global
9-
import cats.effect.IO
108
import scalajs.js
9+
import utest._
1110

1211
object CBIOBundleTests extends TestSuite {
1312

14-
def delay(milliseconds: Int): Future[Unit] = {
13+
private def delay(milliseconds: Int): Future[Unit] = {
1514
val p = Promise[Unit]()
1615
js.timers.setTimeout(milliseconds) {
1716
p.success(())
@@ -23,14 +22,14 @@ object CBIOBundleTests extends TestSuite {
2322
Globals.clear()
2423

2524
"catnip" - {
26-
// withRenderedIntoDocumentAsync(Catnip.Component("omg")) { m =>
2725
withRenderedIntoDocumentFuture(Catnip.Component("omg")) { m =>
28-
delay(500).map(_ =>
29-
// assertEq(Globals.catnipMounts, List("omg"))
30-
assertEq(m.showDom(), "<div>Hello(1) omg</div>")
31-
)
26+
delay(500).map { _ =>
27+
assertEq(Globals.catnipMounts, List("omg"))
28+
assertEq(m.showDom(), "<div>Hello(1) omg</div>")
29+
}
30+
}.map { _ =>
31+
assertEq(Globals.catnipMounts, List("omg"))
3232
}
33-
// assertEq(Globals.catnipMounts, List("omg"))
3433
}
3534

3635
}

0 commit comments

Comments
 (0)