qlkit

https://medium.com/@conrad_9565/lets-build-a-ui-with-qlkit-and-graph-queries-79b7b118ddac
dominicm 2018-01-30T07:54:47.000376Z

Yeah, I got very excited when I saw the raw demo :) I've been trying to figure out what I can build to demo how qlkit would fit into our platform.

sichacvah 2018-01-30T08:13:54.000339Z

Hello, Do you plan to support react-native?

drcode 2018-01-30T16:23:33.000300Z

@sichirc certainly we'd like to support react-native, but we're bandwidth constrained-

drcode 2018-01-30T16:23:56.000612Z

unlikely to happen soon (at least as a project internal to our company)

sichacvah 2018-01-30T16:28:51.000856Z

can I open a pr that adds support for re-natal integration?

drcode 2018-01-30T16:31:42.000333Z

@sichirc absolutely 🙂

dominicm 2018-01-30T16:36:54.000204Z

@sichirc How much is involved in getting integrated with re-natal? (I'm curious)

2018-01-30T16:42:22.000446Z

I was reading the announcement on Medium and I'm not sure I understand this correctly. Is it saying everything re-renders on every change? If that's the case, why use react?

2018-01-30T16:43:28.000409Z

Also, can we expect a totally awesome music video for this in the future? 😄 (not serious here, but the one for your book was totally awesome 😄 )

sichacvah 2018-01-30T16:45:12.000696Z

defcomponent macro creates react class with implemented shouldComponentUpdate method

sichacvah 2018-01-30T16:45:47.000246Z

@dominicm I'm one

dominicm 2018-01-30T16:54:42.000582Z

@bmaddy React still does the diffing, om.next etc, just do additional efforts in this area.

👍 1
dominicm 2018-01-30T16:55:13.000081Z

@sichirc Sorry, I was unclear when I asked. What kind of changes are required to make it happen?

sichacvah 2018-01-30T17:00:04.000849Z

sorry for the misunderstanding, right now qlkit has function refresh, this function call reactDOM.render, this function is called in different places in code

drcode 2018-01-30T17:01:16.000601Z

@bmaddy Yes, diffing is still happening on several different levels, we rely on react to optimize the rendering. However, OmNext goes BEYOND vanilla react to optimize rendering- Qlkit doesn't take those additional steps, but still optimizes rendering like any react app.

👍 1
drcode 2018-01-30T17:02:19.001093Z

I will clarify this in the medium article

dominicm 2018-01-30T17:04:11.000028Z

@sichirc Is supporting react native as simple as swapping that function call for:

(if (react-native?)
  js/reactNativeDOM.render
  reactDOM.render)
or something like that?

sichacvah 2018-01-30T17:06:53.000424Z

in react native we don't have render function, we need to register component in app registry, and do it only one time when up starting

drcode 2018-01-30T17:07:23.000727Z

@dominicm unfortunately I haven't played with react-native so far and can't contribute to these sorts of questions (yet)

sichacvah 2018-01-30T17:08:32.000723Z

@sichirc uploaded a file: https://clojurians.slack.com/files/U8ZCX3J9W/F90TE65K5/-.clj

dominicm 2018-01-30T21:51:41.000378Z

I was told that om.next would be very difficult to translate to GraphQL, I'm looking at what qlkit's query language is like, and it seems like it would be viable to hook this up!

👍 1
dominicm 2018-01-30T21:54:20.000062Z

Although, the clj backend seems stateful, with atoms and such. Which doesn't seem like it would work with the reloaded workflow for the server.

drcode 2018-01-30T21:56:43.000162Z

@dominicm well, the backend in the demo app was just designed as a quick demonstration- the expectation is that you'd replace the atoms with datomic or some other database for a more substantial app.

drcode 2018-01-30T21:57:42.000359Z

The part of the server that's important in these types of query language systems are the parsers, but where those parsers put the data is flexible based on the needs of the app.

dominicm 2018-01-30T22:09:10.000132Z

@drcode does ql/mount have no impact on how ql/parse works? (In clj)

drcode 2018-01-30T22:12:03.000124Z

I think you're referring to ql/parse-query (there is no ql/parse)- The parsers defined in ql/mount will determine what parsing methods are called by ql/parse-query

drcode 2018-01-30T22:14:44.000301Z

qlkit assumes that there is only one set of parsers on the client, and one set on the server- These are globally defined by calling mount. This differs from OmNext where you can have multiple sets of parsers on client or server (but at the cost of complexity in terms of how the parser for a parent query term triggers the parser for child query terms)

drcode 2018-01-30T22:15:48.000676Z

(also, it means you can't mount more than one root qlkit component into the dom, which we consider acceptable as mounting multiple completely independent root components is an uncommon requirement, and you can still work around this with advanced-compiled clojurescript)

dominicm 2018-01-30T22:23:40.000118Z

This seems particularly difficult for having apps which service distinct clients. It seems that if the state was passed around explicitly, then library users can manage the state as required

drcode 2018-01-30T22:29:14.000072Z

are you saying that you want a separate state for each client the server services? I guess what would make more sense to me is that each client has some sort of ID (session ID, userid, etc) and then the server stores info about all clients in a single place (database, atom, etc) but just associated with a specific user's id.

drcode 2018-01-30T22:31:17.000519Z

Then the question is just "how do the parsers know what the current user is that's being serviced?" and we have a precise mechanism for that: The root parser on the server does something like (assoc env :user-id id) when it calls parse-children (as in the demo example with todo-id) and then all the children have access to the current user identifier.