locked
Navigation.navigate does not copy the given state but instead puts a reference to it on the backstack

    Question

  • which leads to unexpected behaviour.

    When you do this:

    var options;
    options = this._options;
    options.inTrash = true;
    Navigation.navigate(app.router.routes.trash, options);

    Then the options hash that is put on the backstack is the same as this._options

    So when you navigate back, the stack already contains state.inTrash for the previous state. Difficult to explain. But easy to run into if you not construct the state from scratch each time you call Navigation.navigate. The question is: Why does it not clone the state object but instead just saves a reference to it?

    Wednesday, October 10, 2012 4:00 PM