-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEATURE query-params-new] Query params rewrite #4008
Conversation
Build is failing due to unmerged Handlebars dependency wrt subexpressions |
Looking good @machty. Do query param changes always use replaceState? |
@machty Before merging please find a moment to look at: Or just http://jsbin.com/ucanam/2741# with some weird behaviors when having nested routes. Thanks! |
@asaf Thanks! will do. There are a few more things, including this, that need some polish before it merges; I'll make sure to check in with you to make sure everything's good to go before merging. |
@machty Cool, keep me updated when this issue is fixed so I can continue the migration, Thanks. |
@machty Issue I previously reported was fixed, thanks. |
@asaf nice! it did reveal some further issues so I'm still plugging away at some corner cases. |
@machty Thanks, another thing, regarding TransitionToRoute behavior with QPs, Assuming you have a route such
TransitionByIntend calculates query params changes by expecting QP to have full path of the controller name, so old query param of a controller such 'admin.posts.index[someParam]' will be compared to 'someParam' which obviously will fail, The user should provide the query param name only while behind the scene we should concat the fully qualified QP controller's name with it. It's obvious that if you transition to some route you know ahead its name but:
Thanks. |
"The user should provide the query param name only while behind the scene we should concat the fully qualified QP controller's name with it. Yes that's exactly what should happen. afaik the TODO list on this PR is:
|
@machty 👍 You should carefully design the active property calculation of link-to, we discussed this a bit here: I can think of many reasons why to take into consideration QP when calculating whether a link is active or not and the opposite, IMO we should support both, for instance we build on top of QP some data filtering mechanisms but the selected item is still the same even though QP may change, this behavior of course may not fit other scenarios. |
@asaf one thing that @alexspeller reminded me of is that you can always pass in a bound value for But I don't know how ultimately sustainable that is; I don't think controllers should be containing logic about active class stuff; what we'll likely do in a later PR is add a subexpression helper for the active class to specifically to everyone's needs, e.g. |
@machty I dislike the active=controllerProp due to the reason you've mentioned, Take QP into consideration and don't, mainly. the 2nd option you suggested hard codes the values so i'm not sure how usable it is (unless u can say But yes, it requires some thinking, maybe consider waiting a little bit before implementing anything and see some community response. |
@asaf I've updated the PR to fix the transitionTo behavior as discussed, wanna give it a whirl? |
@machty Will check this out, Another issue I found, a bit hard to debug but I trust your work :) Assuming you have some controller Now assume that the second hit cause the model hook to return a rejected promise, this bubble up to the application route's actions:error and we capture the failed Then in the login route we try to invoke This should cause a transition to the
Thanks a lot! |
@asaf The issue boils down to "what does it mean to retry a transition with a RefreshIntent, which is tied to a particular route hierarchy at the time refresh was called". Fortunately, there is a solution, hope to push the update tomorrow. Thanks for your continued gauntlet-testing |
@machty Awesome. |
See here for some examples: https://gist.github.com/machty/8167051 Depends on Handlebars subexpressions: handlebars-lang/handlebars.js#690
[FEATURE query-params-new] Query params rewrite
@gagoman try using canary. Query Params still isn't in beta channel yet. |
@raytiley same for canary.
didn't helped too. So there are no builds with this feature? |
It was removed from the beta channel unfortunately... On 11 February 2014 20:15, Alex Khomchenko [email protected] wrote:
|
@raytiley thanks a lot. I've also noticed that I should to place |
@gagoman Yes, since the the features must be enabled when Ember itself is evaluated, you must have set the |
Should the query params be available via controller properties in |
I'm curious about the answer to the questions by @ebryn and @mutewinter regarding using pushState/replaceState. At this point, no history entry is made for a query-params change which to me is unexpected behavior considering the fact that they usually modify the state in some way. |
@joostdevries we're changing the default to pushState and making it configurable in the next iteration, hopefully within the next 10 days |
👍 Awesome! |
Not sure if that is the place to post that, but just trying out this feature and it only seems to work in the ApplicationController for me and no other controller. App.ApplicationController = Ember.ArrayController.extend({
queryParams: ['style'],
style: 'test'
}); works, but App.IndexController = Ember.ArrayController.extend({
queryParams: ['style'],
style: 'test'
}); does not and throws: Error while loading route: TypeError: Object #<Object> has no method 'addArrayObserver'
at Ember.ArrayProxy.Ember.Object.extend._setupArrangedContent (http://builds.emberjs.com/canary/ember.js:19698:23)
at null._arrangedContentDidChange (http://builds.emberjs.com/canary/ember.js:19688:10)
at sendEvent (http://builds.emberjs.com/canary/ember.js:2572:14)
at notifyObservers (http://builds.emberjs.com/canary/ember.js:2958:5)
at propertyDidChange (http://builds.emberjs.com/canary/ember.js:2803:3)
at iterDeps (http://builds.emberjs.com/canary/ember.js:2841:7)
at dependentKeysDidChange (http://builds.emberjs.com/canary/ember.js:2825:3)
at Object.propertyDidChange (http://builds.emberjs.com/canary/ember.js:2801:3)
at Object.set (http://builds.emberjs.com/canary/ember.js:3036:15)
at ComputedPropertyPrototype.set (http://builds.emberjs.com/canary/ember.js:4992:13) Is that a known bug? |
@Globegitter can you provide a jsbin? Someone in #ember had this issue the other day and it was because they were using an |
@raytiley Oh yeah, if I provide the |
just tried the latest canary and it gives me this error this is when its used from within an {{#each}} |
This example here: http://emberjs.jsbin.com/ucanam/2849#/?foo[]=ray&foo[]=freakin&foo[]=tiley shows how Trying to use brackets in the link-to handler just throws an error in the |
I ran into another issue. I am using (It is really long, so thought I'd not pollute this thread here) As a note, I have @machty any idea what could be the issue? |
@Globegitter I'm guess something's rearranged in your dist build that is either removing your feature flag enablement code or moving it after the Ember library's been included. |
@machty Oh yeah that was it. Thanks for the help. Also any word about the arrays in the |
Hi , I am playing with query-params-new feature, (just trying to migrate from Ember 1.4.0 Beta-Canary to 1.6.0 Beta-Canary) and came across this issue http://emberjs.jsbin.com/wulij It looks like {{link-to}} helper is broken , it marking all links "active" irrespective of route. Please to help. |
I figured out how to force query params to make a history entry. Implement Full example: actions:
queryParamsDidChange: (queryParams) ->
this.router.router.refresh(this).method('updateURL') /cc @joostdevries |
Hi guys, anyone looking into {{link-to}} helper issue for active routes ?Here is jsbin http://emberjs.jsbin.com/wulij All links are getting marked as active irrespective of route. And it is happening with canary build only. :( |
Hey, what's the status on this feature? I'm using it in my current project and really like it. Is this still being developed / considered for inclusion? Or should I remove it while I still can do it relatively easily? |
ivanpantic82 Its working fine in latest canary builds |
Yeah, that's the point - it seems fine, yet it skipped 1.4, 1.5 and I don't see it in 1.6 beta so far. Is there some issue I should know about? I'm developing using canary build ATM, but I'd much rather move to beta or release before I get too far into production use. |
Well that answers my question, thanks. |
What's the status on |
@szalishchuk I had something very similar to your experience transitioning to another nested route using replaceWith from afterModel. I had to pass the current query params for the current transition to not get the same error as you. My stackoverflow "workaround" here: If you have a jsbin that replicates the issue then I am sure that would be helpful for someone like @machty who has intimate knowledge of the Ember router. |
@ahacking thanks I will try that out. Although since I do |
See here for some examples: https://gist.github.com/machty/8167051
Depends on Handlebars subexpressions:
handlebars-lang/handlebars.js#690