-
-
Notifications
You must be signed in to change notification settings - Fork 814
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
crmRouteBinder - Remove params from url if they equal their defaults #14211
Conversation
(Standard links)
|
@@ -50,18 +50,18 @@ | |||
registerGlobalListener($injector); | |||
|
|||
options.format = options.format || 'json'; | |||
var fmt = formats[options.format]; | |||
var fmt = _.clone(formats[options.format]); | |||
if (options.deep) { | |||
fmt.watcher = '$watch'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding _.clone()
on l53 prevents line 55 here from modifying the global defaults.
|
||
var $route = $injector.get('$route'), $timeout = $injector.get('$timeout'); | ||
|
||
var value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some cleanup
if (p[k] === v) { | ||
delete p[k]; | ||
} | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just cleanup - expanded the 1-liner on l82 to be more readable.
I haven't tested, but want to give a conceptual 👍 -- if the same value would be loaded as a default, then it's preferable to appear shorter and normalized. For someone
|
This works as nicely as before
This works too. I managed to break this if I added multiple parameters with the same key but it's also the case without this commit, I checked.
This is fine. No problem modifying the existing parameters nor adding new one.
It works
It works too I tested all those points against dmaster using firefox nightly (for maximum breakage) and chromium. |
Overview
Reduces url clutter in the Api4 explorer and fixes a bug with
null
being cast to0
.Before
When removing a param in the api4 explorer, it persists in the url. This is a problem in the case of the
Relationship
api and the$current
param. To reproduce:Relationship
get
.Current
radio button.x
to clear theCurrent
radio selection.current=0
is still in the url.false
radio will be selected inappropriately.After
Clearing a selection from the api explorer will remove it from the url, which reduces clutter and prevents errors.