Closed Lysander closed 6 months ago
Just thinking about, whether subModel
might be a more fitting name? So messagesOfSubModel
?
Just thinking about, whether
subModel
might be a more fitting name? SomessagesOfSubModel
?
Ok, I have renamed this.
Motivation
Up to the
RC5 / RC6
version of fritz2, themessages()
-function onStore
s just matched the exact path. This behavior was changed by those release candidates: Right now all messages that matches the exact path, but also all messages machining the sub-path will be collected.Our experience has shown, that this behavior change was a mistake, as the 80% use case is to collect all messages for an exact path. Most of the time one has dedicated form elements, that fit exactly one property of a model and thus should only show messages for itself. It is very rarely happening, that all messages of a sub-model should be shown all together.
This is why this PR changes again the default behavior, but also introduces a dedicated variant for collecting all sub-model messages with the new
messagesOfSubModel()
-function.Also, we expose the
messages(filterPredicate: (M) -> Boolean)
-function, which both other functions uses internally. You can use this function apply custom filtering to the messages.Overview
messages()
if you want only exact path-matchesmessagesOfSubModel()
if you want all paths that match exactly or that share the same prefix as the receivingStore
messages(filterPredicate: (M) -> Boolean)
if you want to apply your own, custom filterMigration Guide
If you want to stick with the behavior from RC5 up to now, just rename all your
messages()
calls intomessagesOfSubModel()
and you are done.If you have created custom filtering to get the exact match, in order to bypass the behavior, you can simply drop those now.
Reverts introduced behavior from #767 and #761