Fork me on GitHub
Oliver George12:11:25

I'm getting a "Lookup ref attribute should be marked as :db/unique" but only with advanced compilation. It's driving me crazy.

Oliver George12:11:41

Not looking for answers but is there a support group I can join?


@olivergeorge shot in the dark, but this helped me when I was having advanced compilation trouble with DataScript:;-tricks#externs-and-shadow-cljs


Not sure about a support group other than here.

Oliver George21:11:11

Thanks for sharing @cjsauer. Not using shadow-cljs and I think externs are where they should be ... we'll see. I need to get to a minimal test case.

Oliver George22:11:04

Here's my test case.

(let [db (d/empty-db {:sighting/id    {:db/unique :db.unique/identity}
                        :user/sightings {:db/cardinality :db.cardinality/many :db/valueType :db.type/ref}})
        tx-data [{:user/sightings [{:sighting/id 123}]}]]
    (try (d/db-with db tx-data)
         (js/alert "Success")
         (catch js/Object e
           (js/alert (.-message e)))))

Oliver George22:11:20

Really hoping someone will tell me I'm doing something obvious.

Oliver George22:11:45

Fails with this error "Lookup ref should contain 2 elements: [{:sighting/id 123}]"

Oliver George22:11:15

But only fails with iOS simulator running release configuration.

Oliver George22:11:38

So it seems like some assumption in the CLJS code isn't always true.

Oliver George22:11:50

It's a re-natal project.

Oliver George22:11:05

Need to do more testing of combinations etc.