om-next

danburton 2016-06-01T17:53:21.000110Z

I'm having a hard time understanding when to use params and when to use props. Particularly: I've got a "details view" component which displays the details for (basically) a row in a database. Should this component have a param for the ID of the row it is displaying, and I use set-query to update the param whenever I want to display a different row? Or should the parent component take responsibility for managing which ID to query for, and merely instantiate the details view with the props after the query comes back with data?

danburton 2016-06-01T18:00:07.000111Z

Related. It seems like any functionality provided by IQueryParams can instead be accomplished by props.

(query [this] (let [pseudo-param (if (om/component? this) (-> this om/props :pseudo-param) "default value")] ...))

danburton 2016-06-01T18:01:14.000112Z

So I'm unclear on whether I should be updating the state atom in order to trigger the appropriate query updates, or whether I should be updating the query params in order to trigger the appropriate query updates.

vinnyataide 2016-06-01T19:20:09.000113Z

query param seems like the most appropriate answer

vinnyataide 2016-06-01T19:56:03.000114Z

basically the queries are managed in a parent component in the background, that's how relay works, the params are just the props from the wrapper component that sends the state to the child details view, using state and props just duplicates the idea

vinnyataide 2016-06-01T19:56:53.000115Z

what happens behind the query update is a update in the wrapper components state that triggers the request

danburton 2016-06-01T22:04:38.000117Z

Trying to decide now on whether to represent a query as [([:foo/by-id id] {:limit 10 :etc :etc})] or as [(:foo/detail {:id id :limit 10 :etc :etc})]

danburton 2016-06-01T22:05:32.000118Z

I'm not really sure which is a more "canonical" query for the server to interpret.