tonsky / tonsky/datascript

With empty component, one can create a reference to non-existing entity

Open
#357 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Clojure
Stars
5.8k
Forks
318
PR merge metrics
No merged PRs in 30d

Description

(-> (d/empty-db {:comp {:db/valueType :db.type/ref,
                        :db/isComponent true}})
  (d/with [{:comp {}}])
  :tx-data)

; => [#datascript/Datom [1 :comp 2 536870913 true]]

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the example through d/empty-db and d/with and inspect how the :db.type/ref and :db/isComponent schema are handled during that transaction. Done means the empty component no longer produces a reference datom for a non-existing entity, with regression coverage added for this example.

Written by the indexing model from the issue text.

Assessment

Tech stack
clojure
Domain
database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.