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
m.route( pathString, queryObject) creates new param keys #352
Comments
Can you provide a jsfiddle illustrating the issue? |
Mithril may have a design issue similar to one Node's Express had: http://techblog.netflix.com/2014/11/nodejs-in-flames.html?utm_source=nodeweekly&utm_medium=email The guts of the article are the 3 paragraphs above "When the Smoke Cleared" |
@eddyystop actually Mithril avoids that issue by forcing you to declare routes in one place — you can't add a route node, you can only specify the whole route map in one go. What I'm talking about is a case where I'm trying to modify a query param with a function that's agnostic of the wider route context: // location: 'http://example.com?foo=bar'
m.route( m.route(), { foo : 'baz' } );
// location: 'http://example.com?foo=bar&foo=baz' |
Here we go. In this reduced case a contrived route hash has a single endpoint, The snippet, to avoid over-reliance on jsfiddle: m.route( document.body, '/', {
'/' : {
controller : function(){},
view : function(){
return m( 'pre', {
onclick : function(){
m.route( m.route(), {
foo : 'bar'
} );
}
}, m.route() );
}
}
} ); |
Ok yep, this is a bug. Thanks. |
Fixed in origin/next |
Nice one Leo! |
When assigning strings to keys in the queryObject paramter, my assumption is that an extant param with that key would be replaced, but instead a new key=value pair is appended to the route. In the case where only the last value is read, this is just an issue of ambiguous cruft, but for URI APIs that use multiple key=value pairs to represent list items, this is a functional bug.
The text was updated successfully, but these errors were encountered: