n8 icon indicating copy to clipboard operation
n8 copied to clipboard

setData on locations, verify for nested navigation graphs

Open erdo opened this issue 1 year ago • 0 comments

  1. This already works for linear navigation graphs (see NavigationModelLinearNavTest and the tests that refer to setData), but we need to verify the behaviour for nested navigation graphs, there are some commented out tests in NavigationModelNestedNavTest but they'll need to be re-written.

  2. Consider changing the advice about using plain Strings to identify locations... you still can, but when we send data to locations, the data needs to be kept as part of the location class itself eg:

    @Serializable
    data class ProductPage(val productId: Int) : Location()

If you used plain Strings to identify your locations eg:

    "ProductPage"

You'd need to implement some custom protocal to handle data for example "{locationName}|{data}" eg:

    "ProductPage|123"

And your UI code would have to parse that (rather than just doing location.productId)


...OK I've considered it 😬 let's just mention that in the docs where we say you can use String to identify locations and gently encourage people not to do that unless they understand the implication and have some good reason, can link them to this issue

erdo avatar Apr 28 '24 19:04 erdo