offirgolan / ember-parachute

Improved Query Params for Ember
https://offirgolan.github.io/ember-parachute
MIT License
199 stars 40 forks source link

Preventing a query param change #49

Closed alexlafroscia closed 6 years ago

alexlafroscia commented 6 years ago

What do you think about adding a way to prevent a query param from changing? In a use case where you might bind a tab-like interface to a query param, with the active tab in the URL. With a normal route-driven UI, you could hook into willTransition to prevent a transition, but there's no way to have similar behavior with Parachute. Supporting refreshModel would solve this specific use case, but I know that that's not going to be supported.

I'm imagining something like queryParamsWillChange that could return false to reject the change

offirgolan commented 6 years ago

I think its something that we can work towards supporting. Instead of fully supporting refreshModel we can have an option such as locked and we can do all the work to support something like that (just brainstorming) via the controller and route mixins.

offirgolan commented 6 years ago

Now that I think of it, maybe it would be a good idea to pass through refreshModel but just add some documentation around it. This addon really shouldnt be limiting the functionality of query params, but just improving on it.

@poteto thoughts?

alexlafroscia commented 6 years ago

I can't even remember why I wanted this anymore 🤷‍♂️