Last active
August 29, 2015 14:15
-
-
Save cigitia/c1f1fc48ebc041c979c5 to your computer and use it in GitHub Desktop.
Infinite loop when using pull API on circular component reference (DataScript 0.9.0)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns demo.main | |
(:require [datascript :as ds])) | |
(def schema | |
{:x/component {:db/valueType :db.type/ref ; Required to demonstrate bug. | |
:db/isComponent true ; Required to demonstrate bug. | |
}}) | |
(def conn | |
(ds/create-conn schema)) | |
(ds/transact! conn | |
[{:db/id 1 | |
:x/component {:db/id 1 | |
:c/attribute "bar"}}]) | |
(enable-console-print!) | |
(println "Point A") | |
; The circular reference from 1 to 1 causes an infinite loop when coupled with another bug | |
; when using the Push API on entity 1. | |
; Uncomment line below to induce freeze. | |
#_(prn (ds/pull @conn '[*] 1)) | |
(println "Point B") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment