Skip to content

Commit

Permalink
fix edge case saving large file cause empty content; tag 0.8.8
Browse files Browse the repository at this point in the history
  • Loading branch information
tiye committed Sep 18, 2023
1 parent b2fbad9 commit 57d1d2b
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 50 deletions.
91 changes: 51 additions & 40 deletions calcit.cirru

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 11 additions & 9 deletions compact.cirru
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

{} (:package |app)
:configs $ {} (:init-fn |app.server/main!) (:reload-fn |app.server/reload!) (:version |0.8.7)
:configs $ {} (:init-fn |app.server/main!) (:reload-fn |app.server/reload!) (:version |0.8.8)
:modules $ [] |lilac/ |memof/ |recollect/ |cumulo-util.calcit/ |ws-edn.calcit/ |bisection-key/
:entries $ {}
:client $ {} (:init-fn |app.client/main!) (:reload-fn |app.client/reload!)
Expand Down Expand Up @@ -2881,12 +2881,14 @@
defn on-file-change! () $ let
file-content $ fs/readFileSync storage-file "\"utf8"
new-md5 $ md5 file-content
if (not= new-md5 @*calcit-md5)
let
calcit $ parse-cirru-edn file-content
println $ .!blue chalk "\"calcit storage file changed!"
reset! *calcit-md5 new-md5
dispatch! (:: :watcher/file-change calcit) nil
if (blank? file-content)
eprintln $ .!red chalk "\"got blank file on change, server might have staled"
if (not= new-md5 @*calcit-md5)
let
calcit $ parse-cirru-edn file-content
println $ .!blue chalk "\"calcit storage file changed!"
reset! *calcit-md5 new-md5
dispatch! (:: :watcher/file-change calcit) nil
|reload! $ %{} :CodeEntry (:doc |)
:code $ quote
defn reload! ()
Expand Down Expand Up @@ -4863,7 +4865,7 @@
|db->string $ %{} :CodeEntry (:doc |)
:code $ quote
defn db->string (db)
format-cirru-edn $ -> db (dissoc :sessions) (dissoc :saved-files) (dissoc :repl)
format-cirru-edn $ -> db (dissoc :sessions) (dissoc :saved-files)
|expr? $ %{} :CodeEntry (:doc |)
:code $ quote
defn expr? (x) (&record:matches? schema/CirruExpr x)
Expand Down Expand Up @@ -5118,7 +5120,7 @@
persist-async! (:storage-file config/site) db-content started-time
fn (e)
do
println $ .!red chalk e
eprintln $ .!red chalk e
js/console.error e
dispatch! $ :: :notify/push-message
[] :error $ aget e "\"message"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@calcit/editor",
"version": "0.8.7",
"version": "0.8.8",
"description": "Tree Editor for Calcit Language",
"bin": {
"ct": "./server.mjs"
Expand Down

0 comments on commit 57d1d2b

Please sign in to comment.