First, a few things...
😄 Describe the solution you'd like
I’d like to define the layout of a View dynamically based on state/parameters (e.g. ShopId).
Currently, config.layout(...) is static and must be set inside onInit, which makes it impossible to vary layouts depending on which shop is being opened.
Additionally, the identity of a View is class-based only. This prevents opening multiple instances of the same View class with different state (e.g. ShopView for Shop A vs Shop B). The only workaround I found was creating a separate ViewFrame per shop, which is heavy and awkward.
🧠 Describe alternatives you've considered
- Add support for dynamic layout providers (e.g. config.layoutProvider { ctx -> ... })
- Allow setting a per-instance identity key, so that the framework can treat (View class + state) as distinct instances:
frame.open(player, ShopView::class) {
identityKey("shop:${shopId.value}")
}
This would let developers easily create UIs where the layout depends on context/state without duplicating Views or frames.
🤚 Drawbacks
- Could add complexity to the framework’s internal caching/routing of views.
- Dynamic layouts may require careful handling to avoid invalidation or unsafe updates at runtime.
💻 Platform
⭐ Version
3.5.1
✍️ Additional context
No response
First, a few things...
😄 Describe the solution you'd like
I’d like to define the layout of a View dynamically based on state/parameters (e.g. ShopId).
Currently, config.layout(...) is static and must be set inside onInit, which makes it impossible to vary layouts depending on which shop is being opened.
Additionally, the identity of a View is class-based only. This prevents opening multiple instances of the same View class with different state (e.g. ShopView for Shop A vs Shop B). The only workaround I found was creating a separate ViewFrame per shop, which is heavy and awkward.
🧠 Describe alternatives you've considered
This would let developers easily create UIs where the layout depends on context/state without duplicating Views or frames.
🤚 Drawbacks
💻 Platform
⭐ Version
3.5.1
✍️ Additional context
No response