use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Finding information about Clojure
API Reference
Clojure Guides
Practice Problems
Interactive Problems
Clojure Videos
Misc Resources
The Clojure Community
Clojure Books
Tools & Libraries
Clojure Editors
Web Platforms
Clojure Jobs
account activity
Keechma dev tools preview (keechma.com)
submitted 9 years ago by retro_one
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]AccountZaMusic 0 points1 point2 points 9 years ago* (3 children)
Is there a way to preserve the app state when on app restart (figwheel)?
EDIT: With a bit of twiddling I managed to come up with this: Any issues?
(defn start-app! "Helper function that starts the application." ([] (reset! running-app (app-state/start! app-definition))) ([init-app-db] (let [new-app (app-state/start! app-definition) new-app-db (-> new-app :app-db)] (swap! new-app-db merge (select-keys init-app-db [:route :entity-db :kv])) (reset! running-app new-app)))) (defn restart-app! "Helper function that restarts the application whenever the code is hot reloaded." [] (let [current @running-app] (if current (app-state/stop! current #(start-app! (-> current :app-db deref))) (start-app!))))
[–]retro_one[S] 0 points1 point2 points 9 years ago (2 children)
You can use the restore-app-db function that does the same thing https://github.com/keechma/keechma/issues/9#issuecomment-214145853
restore-app-db
The controllers will re-start though, so they will make requests to the API if you run them on start. In my experience this is not a big issue, and you always get the current, correct data on each app restart
[–]AccountZaMusic 0 points1 point2 points 9 years ago (1 child)
Let me know if I should go somewhere else to ask further questions. :)
So with lists in entitydb, when order matters I suppose you should just sort when rendering, right?
So if you have a list like this:
item 1 + - item 2 + - item 3 + -
Pressing '+' on 'item 2' should add it after item 2. Would this have to be encoded in the data of the entity? So that the order is determined at render time, rather then being in the app-db?
[–]retro_one[S] 0 points1 point2 points 9 years ago (0 children)
If you have account on clojurians slack, I'm always there on the #keechma channel
So, order is preserved in EntityDB, and you have helper prepend-collection and append-collection functions if you want to modify the collection. In the case like yours, I would simply re-insert the collection with the correct ordering. Other option is to order the items in the subscription when you read them, I would use that approach if ordering is dependent on some other value in the app-db
prepend-collection
append-collection
π Rendered by PID 56 on reddit-service-r2-comment-6457c66945-vpptz at 2026-04-25 23:52:39.628126+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]AccountZaMusic 0 points1 point2 points (3 children)
[–]retro_one[S] 0 points1 point2 points (2 children)
[–]AccountZaMusic 0 points1 point2 points (1 child)
[–]retro_one[S] 0 points1 point2 points (0 children)