qlkit

https://medium.com/@conrad_9565/lets-build-a-ui-with-qlkit-and-graph-queries-79b7b118ddac
drcode 2018-01-26T12:36:51.000286Z

happy to answer any questions here (which will also help us improve the qlkit FAQ https://github.com/forward-blockchain/qlkit/wiki/Qlkit-FAQ)

drcode 2018-01-26T19:41:10.000476Z

Hi @tacosundae great tl;dr in the reddit thread!

drcode 2018-01-26T19:41:24.000456Z

(unless that's a different "tacosundae")

tacosundae 2018-01-26T19:41:29.000051Z

In the FAQ you state that the queries are static and that the smarts should be in the parsers. What I seem to be missing is how to set the query parameters from a component. You give the example of [:persons/search {:name-prefix "smit"} [:person/name] [:person/age]]. How do I link that up in the component?

tacosundae 2018-01-26T19:41:36.000433Z

tyup that was me ^^

drcode 2018-01-26T19:44:34.000203Z

@tacosundae Let me rephrase to see if I understand your question: You're saying you have a component, let's say hypothetically a "search box" that has differing data needs over time, i.e. you want a parameter on the query to change when the search text changes. Is that what you're asking?

tacosundae 2018-01-26T19:44:47.000658Z

exactly

drcode 2018-01-26T19:45:32.000471Z

Is the data that satisfies the query coming from the client state or from the server? (my answers are different in each case)

tacosundae 2018-01-26T19:46:23.000271Z

I suppose that would make a difference. I can hazard a guess to the server case. chat about the client?

tacosundae 2018-01-26T19:46:32.000456Z

what*

drcode 2018-01-26T19:47:11.000231Z

Well, let me address the server case first, just to organize my own thoughts...

drcode 2018-01-26T19:51:19.000104Z

My experience with these query lange systems is that you end up in a world of pain if you have a parameterized query in the UI that gets sent to the client parsers, then later to the server parsers. A much better approach is to "lift" the search parameter into the global client state, making this a two-step process. So the steps are: 1. The component sends a transaction [:widget/search-param-set! search-string] 2. The remote parser builds the parameterized query

tacosundae 2018-01-26T19:52:24.000848Z

I believe I see where this is going. you then have the parser parameterize the query from the global state?

drcode 2018-01-26T19:52:53.000196Z

For the client case, your options are either to do the same thing as in the server case, or to simply grab ALL the data into the component (a browser client just has a small amount of data anyway) and then just filter it directly in the render routine of the component (or do some fancier optimizations that amount to the same thing)

drcode 2018-01-26T19:55:28.000308Z

@tacosundae yes, so you have a read parser for :myapp/widgets (or if you want to break out search as a separate concern, :widgets/by-search-term) and that parser just pulls the :widget/search-param out of the client state

drcode 2018-01-26T19:56:31.000175Z

@tacosundae or you just use the alternate "brute force" approach and just grab all the widget data with the query and just filter it in real time in the component.

drcode 2018-01-26T19:56:58.000069Z

Qlkit makes the assumption that "client side computing cycles are cheap"

drcode 2018-01-26T19:58:02.000430Z

This may not always be an accurate assumption- OmNext definitely trades off better performance for a more complex library and that may be a better choice in some cases

tacosundae 2018-01-26T19:58:35.000191Z

Thanks alot, that clears it up for me. Btw (assuming this is conrad) will we ever have a Country of Clojure?

drcode 2018-01-26T20:00:18.000334Z

It's been discussed, never happened though- Writing books is a lot of work 🙂

tacosundae 2018-01-26T20:00:34.000588Z

I bet!

drcode 2018-01-26T20:02:54.000197Z

FYI this info is going straight into the github faq