This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-10-15
Channels
- # announcements (1)
- # babashka (81)
- # beginners (48)
- # calva (49)
- # clj-kondo (52)
- # cljdoc (7)
- # cljs-dev (39)
- # clojure (33)
- # clojure-australia (18)
- # clojure-europe (48)
- # clojure-italy (2)
- # clojure-morsels (2)
- # clojure-nl (3)
- # clojure-uk (6)
- # clojurescript (5)
- # community-development (2)
- # conjure (6)
- # cursive (3)
- # data-science (29)
- # datalog (4)
- # datomic (14)
- # events (1)
- # fulcro (1)
- # graphql (18)
- # gratitude (2)
- # helix (11)
- # introduce-yourself (2)
- # java (15)
- # keyboards (2)
- # lsp (6)
- # luminus (4)
- # membrane (32)
- # minecraft (1)
- # missionary (7)
- # nextjournal (2)
- # off-topic (28)
- # portal (28)
- # releases (1)
- # ring (1)
- # shadow-cljs (3)
- # sql (6)
- # xtdb (23)
Hi I've just started using Portal in VS Code (big thanks to @djblue for the tool and @seancorfield for helping me set it up!) - one strange thing I noticed when tap>
-ing Datomic data into Portal is that :db/id
values are not being shown correctly. My actual data has all distinct :db/id
values, but when I inspect the data in Portal the :db/id
s all show up as the same value. I'm wondering if :db/id
has some special meaning in Portal that is conflicting with these values in Datomic data?
Here's an example. Note in the following tap the :db/id
s are all different:
(tap> [{:db/id 4611681620380904123, :foo/id "FOO", :foo/children [#:db{:id 4611681620380904121} #:db{:id 4611681620380904122}]}])
But when it shows up in Portal all the :db/id
s look like this:
▼ [
▼ {
:db/id 4611681620380904000
▼ :foo/children [
▼ {
:db/id 4611681620380904000
}
▼ {
:db/id 4611681620380904000
}
]
:foo/id "FOO"
}
]
Oh now that I'm looking at it it looks like it's rounding all the :db/id
values to 4611681620380904000
Yeah it looks like if I try sending any long value to Portal it will only keep 16 decimal places of precision:
(tap> 4611681620380904123)
shows up in Portal as:
4611681620380904000
What data type are those :db/id
values? I suspect this is cljs/JS interop...
(so this is purely a display issue -- not that it helps you much)
looks like this is a Javascript issue: https://stackoverflow.com/questions/17320706/javascript-long-integer
JS represents all numbers as 64bit floating point, so it can't represent all longs precisely
It is just a display issue, but it would be nice if this could be addressed - when this first showed up I thought I screwed up my Datomic transaction data, when in reality it was fine
Open an issue on the repo -- but I doubt much can be done given JS limitations.
I think I fixed the issue with https://github.com/djblue/portal/commit/4120fabd0a115f9c46e7a65b65301dcd15b2f188 👌
could you publish a new version of the VS Code extension with this fix? or can i get a vsix file to use?
@djblue Does that issue affect the browser version or just the VS Code version?
And of course we can't test it from a git deps because of the main.js
thing, right?
one thing I noticed tho is that longs show up as normal numbers in :portal.viewer/inspector
and :portal.viewer/table
, but in :portal.viewer/tree
they show up like:
{
:rep "4611681620380904123"
:tag "long"
}
https://github.com/djblue/portal/commit/cf640d9d0e1a9de5b039dd005b47721c12a16b6a should fix the issue you discovered 👌