Skip to content

Commit

Permalink
Fix serialization options
Browse files Browse the repository at this point in the history
We use pr-str-safe to serialize 10x's app-db to localstore, protecting
its integrity. Otherwise, 10x crashes at load if the user happens to
set any global vars like *print-length*. Sadly, this crash stays with
them until they clear their localstore.

Our pr-str-safe function misunderstood a naming quirk in clojure
core:
https://github.com/clojure/clojurescript/blob/e7cdc70d0371a26e07e394ea9cd72d5c43e5e363/src/main/cljs/cljs/core.cljs#L186

Fixed it. Now, it actually protects against the issue.
  • Loading branch information
kimo-k committed Jul 26, 2023
1 parent 698c4d9 commit 6303fcf
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/day8/re_frame_10x/tools/datafy.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@

(defn pr-str-safe [value]
(pr-str-with-opts [value] {:flush-on-newline true
:print-readably true
:print-meta false
:print-length nil
:print-level nil}))
:readably true
:meta false
:print-length nil}))

0 comments on commit 6303fcf

Please sign in to comment.