fritz2 v0.6 Release Notes
Release Date: 2020-07-13 // almost 4 years ago-
๐ฅ breaking changes
๐ This release contains changes that break code written with earlier versions:
๐ You no longer need to inherit
WithId
in your model-classes (the interface has been removed from fritz2 entirely). Instead, you need to provide a function which returns the id of a certain instance. This function can be used when callingeach
or creating aSubStore
for a certain element (PR#94):// in commonMain@Lensesdata class Model(val id: String, val value: String)// in jsMainval store = RootStore<List<Model>>(listOf(...)) render { ul { store.each(Model::id).map { modelStore -> render { li { modelStore.sub(L.Model.value).data.bind() } } }.bind() } }.mount("target")
All of the
each
methods (PR#113) were unified:๐ use
Flow<T>.each()
to map each instance of T to yourTag
s. It uses Kotlin's equality function to determine whether or not two elements are the same, and therefore re-renders the whole content you mapped when an element is changed or moved.with
Flow<T>.each(idProvider: (T) -> String)
you can also map each instance of T to yourTag
s, but it uses the given idProvider to determine whether or not two elements are the same. In your mapping, you can get aSubStore
for an element usinglistStore.sub(id, idProvider)
, so only the parts that actually changed will be re-rendered.๐ use
Store<List<T>>.each()
to map aSubStore<T>
toTag
s. It uses the list position of the element to determine whether or not two elements are the same. This means that when inserting something into the middle of the list, the changed element AND ALL following elements will be re-rendered.with
Store<List<T>>.each(idProvider: (T) -> String)
you can also map aSubStore<T>
toTag
s, but it uses the given idProvider to determine whether or not two elements are the same`, so only the parts that actually changed will be re-rendered.๐ renamed
handleAndEmit
tohandleAndOffer
(PR#109)๐ renamed
ModelIdRoot
toRootModelId
to follow the naming of stores (PR#96)๐ new features
- โ add static text in HTML by
+"yourText"
(PR#95) - โ add HTML-comments by
comment("yourText")
or!"yourText"
(PR#108) - ๐ use the
action
function to dispatch an action at any point in your code (PR#117)
๐ fixed bugs
- ๐ fixed handling of
value
andchecked
attributes (PR#81) - ๐ fixed
MapRouter
to useMap<String,String>
(PR#82) - ๐ fixed double
kotlin
-block in gradle build-file (PR#97) - ensure order of children when mixing static tags with bound values on the same level by using
bind(preserveOrder = true)
(PR#102) - classes of HTML-tags are now open so you can inherit your own tags from them (PR#104)
SingleMountPoint
forBoolean
(leaving out the attribute if false) (PR#105)