re-frame

Nim Sadeh 2023-08-03T12:03:20.630289Z

Hello, when I load my db namespace into the Clojure repl and print the DB after doing operations in re-frame I just get the initial db state. Is there a way to inspect the DB using the repl? I am a Clojure newbie sorry if that doesn't make any sense

thheller 2023-08-03T12:04:22.735159Z

a regular CLJS REPL will show you the current state. could be that you are not using the correct REPL or a CLJ REPL?

2023-08-03T12:16:25.401069Z

Not what you asked, but perhaps use re-frame-10x? Create an app using the re-frame-template will show how you get it included in your project.

Nim Sadeh 2023-08-03T12:23:06.052499Z

I’m using the CLJS REPL in shadow. I cloned this template: https://github.com/PEZ/rn-rf-shadow/tree/master. Is it possible that it’s because app-db is not wrapped in a ratom?

thheller 2023-08-03T13:23:26.799109Z

because that is not your actual app-db, just the initial state

thheller 2023-08-03T13:24:09.721839Z

the actual state you can get via @re-frame.db/app-db in the REPL

Nim Sadeh 2023-08-03T13:29:21.858869Z

Got it, thank you. I am learning re-frame and some of the magic stumps me sometimes πŸ™‚

thheller 2023-08-03T13:29:51.027079Z

in shadow-cljs you can also run (tap> @re-frame.db/app-db) and look at the value in the inspect ui http://localhost:9630/inspect

πŸ™Œ 1
Nim Sadeh 2023-08-03T13:30:38.944279Z

That's amazing, thanks! I'll take a look. @mikethompson thanks for suggesting the re-frame-10x tool as well

Nim Sadeh 2023-08-03T13:30:53.635979Z

Stuff like this is why I invested in learning ClojureScript

p-himik 2023-08-03T15:26:46.979139Z

@nnnsadeh Just in case - check out cljs-devtools as well, it allows you to view CLJS data structures in a very nice way when printed with js/console.log.

πŸ™Œ 1
thheller 2023-08-03T16:03:24.973149Z

doesn't help for react-native builds though?

p-himik 2023-08-03T16:04:43.992419Z

No clue, but I didn't see it being mentioned.