- Upgrade to Scala 2.11.11, 2.12.2 and Scala.js 0.6.15
- Update diode-react to scalajs-react 1.0.0
- Change license to Apache 2.0 (was MIT)
- New
zoomTo
macro to simplify commonzoomRW
use-cases. For example what used to be
circuit.zoomRW(_.a)((m, v) ⇒ m.copy(a = v)).zoomRW(_.i)((m, v) ⇒ m.copy(i = v))
can now be expressed with
circuit.zoomTo(_.a.i)
- Fixed
RefTo
to always useAction
- Moved Diode under
io.suzaku
organization
- Added
dispatchCB
anddispatchNow
toModelProxy
to provide a more explicit way of dispatching in aCallback
or directly - Added a Pot.fromOption convenience method (by @vpavkin)
- Circuit
subscribe
now usesModelRO[T]
in its listener callback so that the listener does not need to care about the type of the model. - Moved many methods from ModelR into its super trait ModelRO
- Support for Scala 2.12
- Updated to Scala.js 0.6.13 (for Scala 2.12 support)
Major change in 1.0.0 was making dispatched actions type safe (fixing #11 in process). Action type safety is based on an implicit type class
ActionType[A]
that must be present in scope for any valid action. Easiest way to achieve this is to utilize the provided Action
type as a
base for all your actions. If this is not possible, for example you have no control over action classes, you need to provide an instance of
ActionType
.
For example if you had something like,
trait MyAction
case class Increase(amount: Int) extends MyAction
case class Decrease(amount: Int) extends MyAction
you can change it to either
trait MyAction extends diode.Action
case class Increase(amount: Int) extends MyAction
case class Decrease(amount: Int) extends MyAction
or
trait MyAction
object MyAction {
implicit object MyActionType extends ActionType[MyAction]
}
case class Increase(amount: Int) extends MyAction
case class Decrease(amount: Int) extends MyAction
Both variations work, but it's recommended to use the Action
type.
This change also reflects on how action batches and empty actions are expressed. What used to be a Seq[A]
is now an ActionBatch
and an
empty action is indicated with NoAction
instead of None
. Both of these new types are subtypes of the new Action
type.
The ReactConnector
was updated in two ways. The first change affects how you connect
your component and requires changes in your code. The
change was needed because the original approach caused a lot of needless unmounting and mounting of the component. In your code you must break
the connect into two parts, where the first part is executed only once creating the connecting wrapper and in the second part the wrapper is used
to connect your own component. For example
staticRoute(root, CustomerRoot) ~> render(connect(_.customerData)(proxy => Customers(proxy)))
should be changed to
val customerData = connect(_.customerData)
...
staticRoute(root, CustomerRoot) ~> render(customerData(proxy => Customers(proxy)))
If you need to specify the type for the wrapper, use ReactConnectProxy[A]
, for example val customerData: ReactConnectProxy[CustomerData]
in the
example above.
Another change was the addition of an optional key
to the component created in connect
(fixes #17).
- Support for silent model changes that do not trigger listeners through
ModelUpdateSilent
andModelUpdateSilentEffect
- Dispatcher supports nested dispatching and queues any dispatch requests received while dispatching a previous action
- Fixed
map
,flatMap
andflatten
inPot
to return a correct type ofPot
instead ofEmpty
/Ready
- Added
ModelRO[S]
trait (for "read-only") to abstract reader functionality that does not need to know about the base model type. Can be used to replace types ofModelR[_, S]
- Updated to Scala.js 0.6.9
- Fixed a bug in
foldHandlers
where model changes in earlier handles were not always taken into account - Fixed a bug in
Circuit
where subscribing to a listener while other listeners were being called resulted in that new subscription being ignored.
- Changed Circuit
actionHandler
type to take current model as parameter to enable chaining of handlers - Added
composeHandlers
andfoldHandlers
to help building action handler hierarchies combineHandlers
is deprecated and replaced withcomposeHandlers
- Exposed
root
model reader in theModelR
trait
- Introduced
FastEq
typeclass to provide suitable equality checking in various cases using===
and=!=
operators. PotCollection
fetching is always asynchronous to prevent nasty corner cases- Circuit subscription requires a
ModelR
instead of a simple function - The
model
in Circuit is now private, overrideinitialModel
method to set the initial value - Updated to Scala.js 0.6.7
- DevTools updated to scalajs-dom 0.9.0 (backwards incompatible change in accessing
indexedDB
)
- Split Diode into
diode-core
anddiode-data
modules as the core functionality is quite stable butdiode-data
(Pot
stuff) is still changing quite rapidly. - Added
AsyncAction
which is a more general base forPotAction
. - Simplified
Pot
by moving everything RetryPolicy related into specificAsyncActionRetriable
.
- Added virtual collections (
PotCollection
) to support lazy loading of data. - Added
RefTo
for referencing data elsewhere in the model. - Added
map
andflatMap
to access model values inside containers (such asOption
) while maintaining reference equality. - Added
zip
to combine two readers while maintaining reference equality. - Added an action processor for persisting application state.
- Moved
Pot
and related classes fromdiode.util
todiode.data
package.
- Upgraded
Effect
s to be real class(es) instead of just type alias for easier composition etc. - Added animation example using
requestAnimationFrame
. - Added TodoMVC example using React.
- Initial version.