precept icon indicating copy to clipboard operation
precept copied to clipboard

`entities` macro breaks when subscriptions are moved to separate namespace

Open JBetz opened this issue 5 years ago • 3 comments

I tried creating a separate module for all my subscription definitions, and all of the subscriptions broke that were using the entities macro. The compiler spit out some undeclared variable warnings, but other than that, there was nothing useful for me to debug it. Replacing usages of entities with entity at least got rid of those warnings, but it took moving everything back into the same module for the usages entities to work again.

The subscriptions are nothing fancy either, so I have no idea what the issue was. Here's an example:

(defsub :notes
  [?eids <- (acc/by-fact-id :e) :from [:note/creation-date]]
  [(<- ?notes (entities ?eids))]
  =>
  {:notes ?notes})

JBetz avatar Mar 09 '19 00:03 JBetz

Really sorry about that! The entities macro was hard to implement. It does some weird stuff, namely splitting the rule it occurs in into two rules. That said there were some var resolution issues having to do with CLJS namespace resolution issues in Clara that were fixed as of 0.18.0 (I think). #111 and #112 talk about very similar issues if not the same you have. Looks like I may have fixed some of it in the latest master but the yet unmerged PR #116 that upgrades Clara to 0.18.0 may fix it fully.

I hope this helps until I can take a closer look.

alex-dixon avatar Mar 09 '19 08:03 alex-dixon

Okay, good to know. I'll just keep things in the same module for now.

Is there anything blocking #116, or does it just need QA?

JBetz avatar Mar 09 '19 15:03 JBetz

Just ran the todomvc example with it. More QA would be good (especially with rules split across namespaces). Nothing's blocking it other than nervousness on my part.

alex-dixon avatar Mar 09 '19 16:03 alex-dixon