Fork me on GitHub
#re-frame
<
2016-11-01
>
knjname09:11:27

Please someone tell me whether app-db can contain non-literal values such like file objects embedded in <input type=”file”> ?

knjname10:11:21

@akiroz Thank you. For maintaining replay-ability, I'd thought app-db value should be serializable one.

ricardo11:11:06

@knjname It’s just a hash map. I don’t think re-frame does any serialization.

ricardo11:11:25

Although reading your reply… I expect you’re right. If you want to be able to trace the whole thing, then chances are you’d want the message parameters to be easily serializable.

mikethompson11:11:44

@knjname we stick strictly to the "only data" rule. Only data in app-db. Only data in events

mikethompson11:11:40

But, yes, file objects are possible

ricardo11:11:28

@mikethompson Definitely reasonable and what we do as well. But I thought it was important to clarify there’s no magic going on.

knjname11:11:21

What if we want to avoid storing such dirty objects in app-db, how can it be? In my case, an SPA user can choose a file :on-change #(dispatch [:store-file (get-file %)]) , and upload the file when pushing upload button #(dispatch [:upload-file]). (Maybe in this simple case, you would recommend me to use local state in the first place.)

joshkh12:11:29

Are there any docs or blog posts that talk about integrating re-frame applications inside of other re-frame applications? I have a hefty reagent component (a data table with lots of features) that's powered by re-frame that I'd like to offer to myself as a dependency in another re-frame project. When the component is required I'd like it to use the parent application's app-db where lots of data is already available. Before I start chasing rabbits, is there a best practice for this?

joshkh13:11:01

I'd also like to dispatch events internal to the embedded re-frame application from the parent application. 🙂

nilrecurring17:11:59

@knjname I have file upload with re-frame in my last project, and I keep the filename in a local ratom. So that on-change acts only on the ratom, and on-click on the submit button I just dispatch [:upload-file file] and do it with cljs-ajax in a handler

grant22:11:40

Are there any docs on when and how to use the 2nd parameter to the inputs functions supplied to re-frame/reg-sub? I know the todomvc example says it's an advanced feature, but it would be nice to understand what kinds of things it can be used for.