Advanced scope navigation When you leverage injec...
# tornadofx
e
## Advanced scope navigation When you leverage injected view models together with a navigation stack, some interesting challenges appear that need to be addressed. If you removed the Back button (
workspace.backButton.removeFromParent()
) or set the
maxViewStackDepth
to
0
you can disregard this particular challenge, but to leverage this powerful navigation paradigm, there are some things you need to think about. Consider our prevous example with an injected
CustomerModel
that represents the currently selected customer in the
CustomerList
while also being used by the
CustomerEditor
to edit that same customer. Then let's assume that there is a way to search for a customer and edit it, perhaps using a
TextField
in the ToolBar of the Workspace as a search entry point. If you search for a new customer and go on to edit it, then navigate back to the previous customer editor, it would suddenly operate on the last customer you set in the
CustomerModel
. You can probably imagine the ensuing havoc.