re-frame-10x icon indicating copy to clipboard operation
re-frame-10x copied to clipboard

Possible to get raw EDN?

Open xiongtx opened this issue 7 years ago • 7 comments

I recall that another re-frame inspector (re-frame-trace? Or maybe re-frisk?) allowed the user to get the raw EDN of e.g. DB state.

I find this faster than having to horizontally scroll, then expand, then scroll again, then expand, etc. This is particularly a problem when keywords have long namespaces.

Is it possible to get the raw EDN out of re-frame-10x?

xiongtx avatar Mar 23 '18 19:03 xiongtx

@xiongtx just keep this little snippet somewhere close

cljs.core.deref(re_frame.db.app_db)

type it in Chrome Dev Tools Console and you get the whole app db state in raw edn form (don't forget to enable custom formatters)

agzam avatar Mar 23 '18 19:03 agzam

☝️This gives me something w/ an expander in the console:

image

xiongtx avatar Mar 23 '18 19:03 xiongtx

oh, well cljs.pprint.pprint(cljs.core.deref(re_frame.db.app_db)), which I admit is a bit silly. And I agree with you: default style used for custom formatter in cljs.devtools (and later adopted in re-trace) is mildly inconvenient.

@mike-thompson-day8 it would be nice to have an option to see things in app-db inspector (or at least copy them to clipboard) "as is"

agzam avatar Mar 23 '18 23:03 agzam

@xiongtx are you asking for prn-str of app-db? What will you do with it once you have it as a string? If the map expansion lived directly below the keyword, would that be more useful for you?

danielcompton avatar Mar 24 '18 01:03 danielcompton

Yeah, anything to help the horizontal scrolling would be good. And maybe an "expand all"?

xiongtx avatar Mar 24 '18 01:03 xiongtx

@xiongtx so once you have the prn-str of app-db, what happens to it after then? It gets pasted into a REPL? Or just into a text buffer for further inspection?

danielcompton avatar Apr 04 '18 10:04 danielcompton

@mike-thompson-day8 I would like to second @xiongtx that the ability to copy the EDN as a string to the clipboard or console would be a very useful thing. Further, since everything is just data, this should be available from all 10x tabs, each app-db inspector, subscription results, events vectors etc. Note: re-frame subscriptions are particularly interesting at times since in more complex cases, they are materialized views of app-db, so ephemeral by nature. I would like to switch to the subs tab and export the result of any sub.

Why ?

  • trivial collection of arbitrary app-db data or subscriptions for fixtures in unit-tests and for docs.
  • save developer time identifying and instrumenting the right event handler or subscription to place pr-str and log to console.
  • ability to further inspect/debug/transform within an editor which understands EDN including IntelliJ/Cursive, Sublime etc.

hipitihop avatar Aug 07 '20 06:08 hipitihop

Would be nice to add a clipboard button in various places, such as pods or pod-headers. It seems doable.

In the meantime, day8.re-frame-10x/traced-result might come in handy to print structures in the repl.

kimo-k avatar Jun 16 '23 14:06 kimo-k

Closed via https://github.com/day8/re-frame-10x/pull/390

mike-thompson-day8 avatar Jul 26 '23 02:07 mike-thompson-day8