Fork me on GitHub
#fulcro
<
2021-03-04
>
Casey14:03:57

Is it possible to embed reagent components in a fulcro app? I want to add some interactive dataviz to my project, and most of the existing cljs ecosystem around this seems to export reagent components. I've seen the youtube video where Tony Kay embed a fulcro app inside a re-frame app, but this isn't quite the same. edit: I assume the answer to my naieve question is, yes it's possible. Does anyone have an example?

tony.kay21:03:10

That is a super nice example. We should add that to an interop section of the dev guide

👍 1
dvingo14:03:06

I can PR it - but which section should it go under? https://book.fulcrologic.com/#_render_middleware ?

tony.kay00:03:43

Hm. Good question. How about in the “Components and Rendering” chapter we add a new sub-section called “Integrating with Reagent” and put it at the end of that chapter, just before the = EQL... heading.

tony.kay00:03:27

Please give yourself credit at the beginning of the new section. Something like (this section and example kindly provided by …)

henrik16:03:15

wrap-file-upload fails with this exception if the AST of the mutation that receives the file upload has a query, and I'm not sure how to debug it. Any tips?

henrik16:03:30

As long as :query is not present in the AST, it seems to work (`:children`, :component, etc. seem to not trigger the exception). However, Fulcro then also seems to not merge the result into the DB. I guess that could be manually rectified with a merge-component! in ok-action. But I'm not sure if file upload mutations just don't support queries, or if I'm using it wrong.

tony.kay21:03:05

There is not a design limitation on using returning with a file upload. Given your exception it looks like it had trouble serializing it, which makes me wonder if you accidentally included a js object in there that it is trying to write over the wire?

tony.kay21:03:43

But it is entirely possible that the wrap file upload middleware isn’t written correctly to support returning

henrik13:03:08

> included a js object in there that it is trying to write over the wire? Well, given that it works if I just dissoc :query from :ast (no changes otherwise), the JS object would have to be located in the query. The query comes from a defsc, so it's unlikely, I think. > But it is entirely possible that the wrap file upload middleware isn’t written correctly to support returning The same thing happens if I try to write the query in comp/transact, so I don't think it's returning-specific.

tony.kay00:03:17

Hm. I’m using the file upload middleware without issue. This is Fulcro 3, latest version, right?

tony.kay00:03:49

but I’m not using mutation joins on those mutations

tony.kay00:03:13

also check transit versions…but I’m guessing I just overlooked that particular use-case when writing the middleware

henrik09:03:22

Fulcro is at version 3.4.17. > also check transit versions… That is interesting, we are aligning our deps with Datomic Cloud, so we are using "outdated" versions (well, clearly not outdated according to Cognitect, but anyway). On the other hand, the faulty requests never leave the frontend, so that shouldn't be it. Our Transit stack looks like this,

{com.cognitect/transit-cljs {:mvn/version "0.8.264"}
 com.cognitect/transit-js   {:mvn/version "0.8.867"}
 com.cognitect/transit-java {:mvn/version "0.8.337"}
 com.cognitect/transit-clj  {:mvn/version "0.8.319"}}

henrik09:03:31

> but I’m guessing I just overlooked that particular use-case when writing the middleware We use them to backfill some data (like the URL pointing to where the file has been uploaded) as part of the response.

tony.kay18:03:07

Feel free to submit an issue with a trivial project (not datomic cloud, but full-stack) that shows the problem. Shouldn’t take long to generate such a project. If you do that, then I’d be willing to work on a patch.

tony.kay23:03:36

This repo you made is just broken. You didn’t install the server-side middleware, and it was just crashing on the server side mutation

tony.kay23:03:28

There’s no server side mutation. This isn’t what I was looking for. I was looking for something that you had tested, and that worked for the non-return case, and that then you added a return request to and it failed. This is just a big broken mess…which isn’t saving me any time 😕

tony.kay23:03:41

I’m fixing the example, so just wait…it’s faster for me to just do it at this pt

tony.kay00:03:14

Yeah, the problem is in the metadata. ast->query pushes the components back into the metadata, and transit tries to encode that, but a Component is not transit compatible

tony.kay00:03:44

Fixed and released as 3.4.18

tony.kay00:03:37

Thanks for trying to build a repro case. It did actually help a little..it was just a little frustrating that the example wasn’t coded as full stack and tested before adding the breakage.

henrik06:03:31

> This repo you made is just broken. You didn’t install the server-side middleware, and it was just crashing on the server side mutation I'm sorry, that was an intentional omission, as the mutation never got far enough to fail on the server side. Since you specified… > Feel free to submit an issue with a trivial project (not datomic cloud, but full-stack) that shows the problem. … I didn't understand that you wanted code to add to your test suite, and I interpreted "full-stack" as meaning "full-stack enough to produce the problem". Once it leaves the frontend, it's no longer Fulcro's problem, I reasoned. Next time, I'll know to produce something working and then break it.

henrik06:03:53

> Fixed and released as 3.4.18 Thank you, that's great!

tony.kay14:03:01

Yeah, no worries. It was doing the POST at the network level and that was failing, so that made it unclear that it was failing for a good reason. I also needed to be able to see the whole thing worked when I got it fixed, and not having anything on the server meant I was seeing a network error that caused me to wonder what was actuallly going on, and there was no way for me to easily verify it would work without the returning….also, once fixed it I still had to write the server side stuff to make sure it really was returning the tree and normalizing it.

holyjak21:03:23

🙏 Help needed: I have started working on https://github.com/fulcro-community/fulcro-exercises, a hands-on follow-up to the https://fulcro-community.github.io/guides/tutorial-minimalist-fulcro/, that forces you to internalize the lessons through a series of practical exercises. So far one multi-step exercise is there. I would really appreciate early feedback, especially from beginners 🙏

👏 6