Skip to content

Commit

Permalink
Docs: Add M8 changes to blog post
Browse files Browse the repository at this point in the history
  • Loading branch information
raquo committed Feb 29, 2024
1 parent b380508 commit 6e604b9
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 7 deletions.
6 changes: 1 addition & 5 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,7 @@ lazy val laminar = project.in(file("."))

useYarn := true,

scalaJSUseMainModuleInitializer := true,

(Compile / fastOptJS / scalaJSLinkerConfig) ~= {
_.withSourceMap(false)
}
scalaJSUseMainModuleInitializer := true
)
.settings(
name := "Laminar",
Expand Down
2 changes: 1 addition & 1 deletion project/Versions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ object Versions {

// -- Dependencies --

val Airstream = "17.0.0-M3-SNAPSHOT"
val Airstream = "17.0.0-M8"

val Ew = "0.2.0"

Expand Down
2 changes: 1 addition & 1 deletion src/test/scala/com/raquo/laminar/tests/SyntaxSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ class SyntaxSpec extends UnitSpec {
)

el.amend(
onMountBind(_ => observable --> ((num: Int) => noop(num * 5))), // #nc
onMountBind(_ => observable --> ((num: Int) => noop(num * 5))),
onMountBind(_ => signal --> ((num: Int) => noop(num * 5))),
onMountBind(_ => stream --> ((num: Int) => noop(num * 5)))
)
Expand Down
24 changes: 24 additions & 0 deletions website/blog/2023-12-04-laminar-v17.0.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,21 @@ Technical notes
* TODO: document in Laminar


### Render JS and Mutable Collections

Previously, Laminar's `children <-- streamOfChildren` syntax required an Observable of an `immutable.Seq` of elements (roughly speaking). Now you can provide observables of any `collection.Seq`, `scala.Array`, `js.Array`, `ew.JsArray` and [`ew.JsVector`](https://github.com/raquo/ew). You may want to use JS collections or mutable collections for efficiency, when rendering very large and/or very frequently updated lists of items.

At the moment this mechanism isn't extensible to custom collection types. If you need that, please let me know.

TODO: Document using mutable collections with observables

As part of this change, I simplified Laminar implicits to use the new `RenderableSeq` typeclass. I believe that these changes are a net benefit, and they should also improve compiler error messages a bit (less of "None of the overloaded alternatives of method ... match arguments").

**Migration:** All Laminar syntax tests pass with the new implicits, however it's possible that some obscure use cases no longer compile if the compiler's ability to resolve new implicits does not exactly match the previous ones.

* If legitimate-looking Laminar code no longer compiles, please let me know. Things like: conversions of strings / numbers / etc. to text nodes, conversions of components (with `RenderableNode` to elements), all of the above but with collections, etc.


## Significant Airstream Improvements


Expand Down Expand Up @@ -181,13 +196,18 @@ See [Airstream#115](https://github.com/raquo/Airstream/issues/115) and [Laminar#

## Smaller Airstream Improvements

* New: `EventStream.fromPublisher` creates an Airstream `EventStream` from Java's `Flow.Publisher` (thanks, [@armanbilge](https://github.com/armanbilge)!).
* This lets you consume FS2, Monix, or some other libraries' streams in Laminar
* New: [tapEach](https://github.com/raquo/Airstream/#tapEach) operator
* Naming: `eventBus.stream` alias to `eventBus.events`, for consistency with Var's `signal`.
* Naming: `signal.changes(op)` alias to `signal.composeChanges(op)`. `signal.changes` (with no parens) remains the same.
* Misc: Better displayName-s
* Shorten default displayName-s (`com.raquo.airstream.eventbus.EventBus@<hashCode>` -> `EventBus@<hashCode>` etc.) for all `Named` types, including observables, event buses, vars, etc.
* Use pretty default names for var signals and eventbus streams (e.g. `Var@<hashCode>.signal`) (this also affects toString)
* **Migration:** your tests might break if they rely on previous default displayName-s
* Fix: The per-item signals provided by the split operator now re-sync their values to the parent signal when restarted – this makes their behaviour consistent with other signals since v15.
* **Migration:** You are unlikely to be relying on the current behaviour, since it is quite undesirable. See [Airstream#120](https://github.com/raquo/Airstream/issues/120) for an example.
* Fix: `split` operator's memoization works for `LazyList` now
* Fix: More robust error reporting
* Handle exceptions that happen while printing exceptions
* Yes, that can happen, and yes, that happened.
Expand All @@ -210,6 +230,8 @@ See [Airstream#115](https://github.com/raquo/Airstream/issues/115) and [Laminar#

**Migration** should be obvious where not specified.

* Creating a custom `RenderableNode` only requires a single parameter now:
* e.g. `RenderableNode(_.node)` instead of `RenderableNode(_.node, _.map(_.node), ...)`
* Drop support for Scala 2.12
* [The RFC](https://github.com/raquo/Laminar/issues/132) has been up for more than a year, and nobody has spoken in favor of keeping support.
* Internal structure refactor:
Expand All @@ -218,6 +240,8 @@ See [Airstream#115](https://github.com/raquo/Airstream/issues/115) and [Laminar#
* Extract some code from `Laminar` trait into `MountHooks` and `StyleUnitsApi`
* Move all the inserters, `InsertContext` and `CollectionCommand` to new `inserters` package
* Eliminate `FocusBinder` object - use `focus` directly
* Remove unused `extraNodes` field from `InsertContext`
* Some children realted internal types now accept `laminar.Seq` instead of `immutable.Seq`
* Naming: `ValueController` -> `InputController`


Expand Down

0 comments on commit 6e604b9

Please sign in to comment.