jwstegemann / fritz2

Easily build reactive web-apps in Kotlin based on flows and coroutines.
https://www.fritz2.dev
MIT License
636 stars 25 forks source link

Consider to accept "pathes" as part of an Id of RootStores #780

Open Lysander opened 11 months ago

Lysander commented 11 months ago

Currently the path property of a RootStore is always the empty String.

This might be wrong in cases, where you want to manage the mapped portion of some larger model-store within a separate local store.

Because of the current behavior, one looses the capabilities of the automatic validation message mapping of the headless components, which relies on the store.path property.

Imho we can simply "pathify" some given Id, by splitting it with substringAfter(".", "") with empty String as missing delimiter value. This way we bypass API breaking, as long as noone has ever used Ids with "dots" inside (which we should definitely explain and demand in an upcoming revise of the validation section of our documentation). So imho this could be considered "none API breaking" and solve this corner case quite elegantly.