Fork me on GitHub
#fulcro
<
2020-06-26
>
zhuxun203:06:24

Currently, file-upload/wrap-file-upload does not put a :response-type into the request, which results in the wrap-fulcro-response refusing to decode the transit JSON in response body. This means that I cannot add any mutation join when making a file-upload mutation. Is this intentional? Thanks!

tony.kay04:06:39

probably just an oversight

murtaza5208:06:11

I updated my chrome to the latest build, and fulcro inspect does not connect - Version 83.0.4103.116 (Official Build) (64-bit). If just says No app Connected

zilti09:06:33

I had problems with Fulcro Inspect as well, and at first thought it was connected to me updating Chromium, but it ended up just being a Fulcro Inspect bug... have you tried uninstalling and then re-installing Inspect?

murtaza5209:06:06

no havent, let me try that

murtaza5209:06:13

did that solve it for you ?

zilti09:06:02

Yes, that solved it for me

murtaza5209:06:06

@U2APCNHCN thanks that solved it for me too !

👍 3
zilti09:06:34

Oh no, is the Fulcro book down? I'm doomed 😞

zilti11:06:46

Yes, was just a short time then apparently 🙂

Eugen12:06:17

Hi, I would love to hear your feedback on the following: How can I build an API that is composable with fulcro ? This is a hard issue but I'm looking for some directions / solutions that work now. I'm working on Apache James (email server) and we need an admin interface. The app is built from multiple components and can have multiple functionalities enabled. For example: we can have things for managing user quota, re-indexing of mailboxes, smtp queue management, etc. Most of these are extensions and can be deployed or not. What is the strategy for handling this use case? Is there a way to compose the API: if I add an extension I can add the API extension for it + deploy the companion UI app. What are your thoughts on this? Is there any prior work related to what I am saying? I can't shake the feeling of this being similar to how kubernetes manages their API - with types and versions https://kubernetes.io/docs/concepts/overview/kubernetes-api/ . Is this possible with fulcro ? Is this possible with clojure (e.g. has anyone done it and shared his solution) ?

Björn Ebbinghaus21:06:30

Well... fulcro is mostly a client library. It can consume any API you want. I recommend to jump over to #pathom and ask @U066U8JQJ about the topic on how to write EQL APIs or how to use the parser on the client to make queries across multiple endpoints.

Jakub Holý (HolyJak)09:06:27

For the UI, each extension could be an independent Fulcro app, mounting to a different, existing html element, I suppose. Do you need any interaction between the UI apps? If so then look into route target component lazy loading and perhaps the multi root renderer

Jakub Holý (HolyJak)09:06:22

Regarding the backend, as Bjorn suggests, @U066U8JQJ might have good input. A simple solution would be perhaps if each extension had its own pathom parser and Ring handler (so each would use the api at eg /extensions/ext-x-id). When you discover / register an extension you would simply add its handler + url to the map of known extension endpoints...

Jakub Holý (HolyJak)09:06:21

If you prefer a single endpoint and Pathom parser that should be ok too - it is just data (look what defresolver does). Simply delay the creation of the parser until all extensions are loaded and expose their resolvers.

Jakub Holý (HolyJak)09:06:42

Regarding how to support plugins, I'd ask in #clojure, look at what Kaocha does.. M

Eugen18:06:45

Thank you for all your feedback. I think I have enough for now to get started.

zhuxun221:06:46

There seems to be another problem that's preventing file-upload from supporting mutation joins. The wrap-file-upload currently uses com.fulcrologic.fulcro.algorithms.transit/transit-clj->str to encode the transation. The latter has the following line:

(let [opts (assoc opts :transform t/write-meta)]
     #?(:cljs (t/write (writer opts) data) ...)..)
This enforces writing of meta. However, typically mutation joins are used with (comp/get-query ....), which will add meta into the transaction. Among the added meta are defsc classes, which cannot be serialized, therefore resulting in error:
react_devtools_backend.js:6 repl/invoke error Error: Cannot write Function
    at Object.writer.marshal (writer.js:452)
    at Object.writer.emitMap (writer.js:320)
    at Object.writer.marshal (writer.js:444)
    at Object.writer.emitObjects (writer.js:173)
    at Object.writer.emitArray (writer.js:184)
    at Object.writer.marshal (writer.js:441)
    at Object.writer.emitTaggedMap (writer.js:377)
    at Object.writer.emitEncoded (writer.js:404)
    at Object.writer.marshal (writer.js:447)
    at Object.writer.marshalTop (writer.js:476)

zhuxun221:06:10

Is there any reason for wrap-file-upload to write meta? That just seems to cause troubles

zhuxun221:06:05

I replaced (ft/transit-clj->str txn transit-options) with (t/write (ft/writer transit-options) txn) in wrap-file-upload and it seems to be working fine now. (`com.fulcrologic.fulcro.algorithms.transit = ft` and cognitect.transit = t)