Query-params-new-new-new-new


#1

I’d like to get some more eyes on https://gist.github.com/machty/d687cab552ecee2f9162 , which have some of my ideas on what needs to happen with query params to get it to beta-ready.

In particular, I need to hear any use cases that aren’t going to be well supported in that gist.

One specific thing: given my idea of using the defaultValue type to determine the deserialization strategy (for numbers at least, maybe arrays?), is there ever an instance, for number query params, that you’d prefer to have a unspecified or null default value? I can’t think of a use case for this… seems like you’d always want a default value to be like 0 or 1 or maybe some items_per_page value, but when would you actually want null?


#2

I like this for common cases, but it still doesn’t handle my weird use case where I’m essentially emulating an existing url structure, and proxying the full contents of the query string (without needing to know it’s underlying structure) to an underlying API.

This is needed for my http://rednit.com reddit client to be able to support any arbitrary reddit url.


#3

I remember your use case; I can expose that in the API but that’s definitely not the hard part of what we’re trying to work out.


#4

True that.

I really like the general approach fleshed out here for everything else.

Moving the definitions into the router is a very good move IMO; but you still don’t lose the easy controller interface into the parameters.


#5

I’ve got a setup like:

App.Router.map ->
  @resource "parent", ->
    @route "one"
    @route "two"

The parent controller has query params general to all of the children and the children have query params specific to their needs.

Right now, I’m able to pretty easily bundle the parent and child query params in the child route to pass to an ajax request. How would I go about doing that in the new proposal?


#6

How are you bundling the parent and child params? paramsFor?

I don’t think your use case will be affected.


#7

I tried this new (uncoded) api out on the examples in the guides, so far so good: https://gist.github.com/machty/3a714c22569863d4b9cc


#8

Wow, didn’t realize this existed. I feel foolish.

paramsFor seems to return all strings – I imagine it’d be returning proper types with the new-new-new changes? In that case, my use case should be fine…