Clojurians
#precept
<
2018-04-04
>

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

alex-dixon18:04:49

Sure. Let me take a look

alex-dixon18:04:05

This looks good, though be mindful with your first sub that you’ll get one name, and it will be the last one that matches

alex-dixon18:04:57

the :segments sub looks like perfect use of the entities macro. There was an issue that never made it into a precept release with clara’s treatment of CLJS namespaces. If you’re not using a later version of Clara and somehow overriding Precept’s version there should be no issue

alex-dixon18:04:10

I’m sorry this isn’t working. I’ll look as soon as I get a chance again, but not seeing anything. The usual startting and stopping everything, lein clean etc is first I’d suggest, to rule out any weird rule creation that may have been the result of hot-reloading and establish we’re working with a clean slate in general

alex-dixon18:04:42

You should be able to place a let block above {:segments ?segments} in your subscription and print out what you’re getting there. Just make sure it’s a single let block wrapping a map

alex-dixon18:04:22

The entities macro is really convenient, but it is just a helper. You can accomplish the same without a lot of extra overhead:

[?e :thing ]
[(<- ?the whole entity (entity ?e)]
=>
(insert! {(guid) :entities-list-item ?entity])

(defsub :my-ents
[?entities <- (acc/all :v) :from [_ :entities-list-item]
=>
{:my-ents ?entities}

amarjeet19:04:38

cool cool, will give it another shot tomrw morning (my time) with things you suggested. And, I am using just [precept "0.4.0-alpha"] in my project. No additional Clara dependency. Working with the precept's project template only.

amarjeet19:04:30

Also, Wanted to understand the difference between db-schema and client-schema. I made some understanding based on the docs, and thought that if I wanna make some API request, then db-schema can kick-in and when I am using query (or inserts) in session, then client-schema can kick-in. But, after some work, I realized that I was wrong. What exactly are the explicit use-cases for the two?

alex-dixon20:04:58

@amarjeet That’s a great idea. It was a feature I wanted but never tried out much. There’s some function that allows you to extract facts that are covered by the db-schema. I’ll try to look into it more so I can provide a better answer and outline the functionality that’s possible right now