Fork me on GitHub
#fulcro
<
2022-02-23
>
hadils16:02:22

I have a problem. I am writing an app in vanilla Fulcro (not RAD). I have a remote mutation in a clj file and I am trying to invoke it from the client db in a cljs file. I have been using:

(eql/query->ast1 `[(com.yardwerkz.model.account/werker-account-setup ~params)])
to translate the mutation name, but this breaks file uploads. What is the recommended solution? Thanks in advance.

tony.kay16:02:09

RAD doesn't matter for this question 🙂 m/with-params , etc. There are helpers to help you get this right

tony.kay16:02:49

you're including a file upload in this particular mutation? Not sure why that would break anything. I think uploads add metadata to the params. could be the EQL functions are losing the metadata?

tony.kay16:02:12

if so that is a bug and the helpers will probably fail as well...using the latest versions? EQL has had a patch or two here and there

hadils17:02:01

I dug into wrap-file-upload on the client side. There is call to query->ast in order to convert the metadata into a file part for upload. But when I use query->ast1 the parameters are not at the level of the vector, but nested one deeper, so it returns nil.

hadils17:02:27

Ah — I may be wrong about this. I am basically not sure why my flle uploads don’t get sent to the backend.

hadils17:02:02

@U0CKQ19AQ I am wrong about this. sorry.

hadils19:02:41

The problem was with the use of FormData in react native, which behaves differently than JS.

hadils19:02:54

DM me if you need the solution.

Quentin Le Guennec19:02:30

for context, this is why I asked that question for: https://github.com/fulcrologic/fulcro/issues/508 Can someone provide me with clues? I'm not sure if I'm doing things right.

Jakub Holý (HolyJak)22:02:26

The question does not provide enough context. Why do you need to query for the SM? An SM can "insert" data 8nto the actor component's place in the client DB, so do that and query for that data.

Jakub Holý (HolyJak)22:02:17

See eg uism/assoc-aliased, uism/alias-value

Quentin Le Guennec22:02:52

@U0522TWDA thanks for your answer. Your blog helped me a bit with that issue. I haven't been able to find any way to get the active-state, though.

Quentin Le Guennec22:02:47

Now I'm using [::uism/asm-id '_] in my query, which kind of works, except I'm pulling any sm, not just the one the component instance is looking for

Quentin Le Guennec22:02:22

I guess I could also manually insert the state with a mutation after each state transition, but it seems counter intuitive to me.

Jakub Holý (HolyJak)10:02:30

Ok so you can't use assoc-aliased because it is not about some data but about the SM's state? Could you change the SM to store its state into the entity using assoc-aliased upon each transition? Hard to advise without understanding more of your problem and design

Quentin Le Guennec15:02:16

thank for your answers, I actually figured it out.

Quentin Le Guennec15:02:12

fulcro is fantastic btw it's a bit of a learning curve but I'm very happy with it!

❤️ 1