Skip to content

Latest commit

 

History

History
146 lines (110 loc) · 5.67 KB

1.5.0.md

File metadata and controls

146 lines (110 loc) · 5.67 KB

1.5.0

  • Support Scala 2.13.x

    Caution: If you use React snapshots on Scala 2.13 you'll be affected by a type inference bug (scala/bug#11660)

  • Drop support for Scala 2.11.x

  • Add to AsyncCallback object:

    • def never[A]: AsyncCallback[A]
    • val unit: AsyncCallback[Unit]
  • Add to AsyncCallback instances:

    • def finallyRun[B](f: AsyncCallback[B]): AsyncCallback[A]
  • Bugfix: Make AsyncCallback.point(x).toCallback pure as it was always supposed to be. The bug was that calling .toCallback used to cause to .point(x) to execute.

  • Add to Callback instances:

    • def setIntervalMs(interval: Double)
    • def setInterval(interval: java.time.Duration | FiniteDuration)
    • def setTimeoutMs(interval: Double)
    • def setTimeout(interval: java.time.Duration | FiniteDuration)
  • delay methods on Callback & AsyncCallback no longer call JS setTimeout when the duration arguments is <= 0; it's a no-op instead.

  • Revision and improvement of all accessibility attributes

    • New attributes:
      • aria.colCount
      • aria.colIndex
      • aria.colSpan
      • aria.current
      • aria.details
      • aria.errorMessage
      • aria.invalid
      • aria.keyShortcuts
      • aria.modal
      • aria.roleDescription
      • aria.rowCount
      • aria.rowIndex
      • aria.rowSpan
    • Value type-safety for nearly attributes
    • Added all legal role values as children (eg. ^.role.button)
  • Revise Monocle modules

    • The ext-monocle module is now deprecated (using Monocle 1.6.0 based on Scalaz)
    • A new ext-monocle-scalaz module exists using Monocle 1.6.0, the last Scalaz-based release
    • The ext-monocle-cats module now uses Monocle 2.0.0 which is Cats-based
    • In the far future, ext-monocle-cats will be renamed simply to ext-monocle
  • Router changes:

    • Added queryToMap to Router DSL to capture the query string as a Map[String, String] (eg. ?param1=abc&param2=123)

    • When setting a route, you can now also specify how the route is set using routerCtl.set(route, SetRouteVia). Existing code that uses routerCtl.set(route) is equivalent to also specifying SetRouteVia.HistoryPush.

    • Support overlapping routes so long as they have conditions, and no more than one conditional route is active at once. In other words, the routes must still be unambiguous, and conditional routes and override unconditional ones. (#549)

    • The following routing rule methods

      def addCondition(condition:         CallbackTo[Boolean])(fallback: Page => Option[Action[Page]])
      def addCondition(condition: Page => CallbackTo[Boolean])(fallback: Page => Option[Action[Page]])

      have been replaced by

      def addCondition                    (condition: CallbackTo[Boolean])
      def addConditionWithFallback        (condition: CallbackTo[Boolean], fallback:                Action[Page])
      def addConditionWithOptionalFallback(condition: CallbackTo[Boolean], fallback:         Option[Action[Page]]
      def addConditionWithOptionalFallback(condition: CallbackTo[Boolean], fallback: Page => Option[Action[Page]]
      
      def addCondition                    (condition: Page => CallbackTo[Boolean])
      def addConditionWithFallback        (condition: Page => CallbackTo[Boolean], fallback:                Action[Page])
      def addConditionWithOptionalFallback(condition: Page => CallbackTo[Boolean], fallback:         Option[Action[Page]]
      def addConditionWithOptionalFallback(condition: Page => CallbackTo[Boolean], fallback: Page => Option[Action[Page]]
    • Deprecated Redirect.Method if favour of SetRouteVia. So for example:

      // Deprecated
      redirectToPage(Home)(Redirect.Method.Replace)
      
      // New style
      redirectToPage(Home)(SetRouteVia.HistoryReplace)
  • Stop simulating Babel's transform-react-inline-elements plugin in fullOptJS. For an explanation, read the comments in build: BuildFn here.

  • Add to Reusable instances:

    • def withValue[B](b: B): Reusable[B]
    • def withLazyValue[B](b: => B): Reusable[B]
  • Add Reusable.fnOutput which is a bunch of convenience methods for creating I => Reusable[O] functions.

  • Add to ReactTestUtils:

    • def withNewDocumentElement[A](use: Element => A): A
    • def newDocumentElement(): Element
    • def removeNewDocumentElement(e: Element): Unit
    • def withNewDocumentElementFuture[A](use: Element => Future[A])(implicit ec: ExecutionContext): Future[A]
    • withNew{Body,Document}ElementAsyncCallback
    • withRenderedInto{Body,Document}AsyncCallback
    • withRenderedAsyncCallback
  • Deprecate and rename in ReactTestUtils:

    • withNewBodyElement{Async => Future}
    • withRendered{Async => Future}
    • withRenderedIntoBody{Async => Future}
    • withRenderedIntoDocument{Async => Future}
  • Create TestBroadcaster in the test module. It's an instance of Broadcaster that is useful in tests.

  • Library upgrades

    • Scala.JS 0.6.31
    • Scala.JS DOM 0.9.8
    • scala-collection-compat 2.1.3
    • sourcecode 0.1.9
    • [module ext-cats] Cats 2.0.0
    • [module ext-cats-monocle] Monocle 2.0.0
    • [module ext-scalaz] Scalaz 7.2.30

Migration

find . -type f -name '*.scala' -exec perl -pi -e '

  s/Redirect\.Replace/SetRouteVia.HistoryReplace/g;
  s/Redirect\.Push/SetRouteVia.HistoryPush/g;
  s/Redirect\.Force/SetRouteVia.WindowLocation/g;

  s/\b(with(?:NewBodyElement|Rendered|RenderedIntoBody|RenderedIntoDocument))Async/\1Future/g;

  s/\baddCondition(.+?)\)\(/addConditionWithOptionalFallback\1, /g;

' {} +