re-frame

thogha 2024-12-10T20:21:15.851399Z

I've got an event handler that returns two dispatch events like so: {:fx [[:dispatch [::rg/init {:ws nil :http {:url endpoint :impl {:headers {"Authorization" (:auth db)}} :supported-operations #{:query :mutate}} :http-options {}}]] [:dispatch [::rg/mutate {:id (str (random-uuid)) :query query :variables variables :callback callback}]]]} When one or the other dispatch is omitted, there is no error, but with both are included, console shows: re-frame: ignoring bad :dispatch value. Expected a vector, but got: ...followed by the response of an unrelated re-graph response. The stack trace is not very helpful. Any ideas?

paola pereira 2025-02-19T09:54:55.390419Z

hey @tom.ghali! How are you? I am with the same problem here, but with a intermittent behavior. Did you find out the cause?

thogha 2025-03-05T19:55:26.281029Z

Hi @paolamartinspe, the issue was caused by repeated initialization of the same re-graph instance. Switching to this multi-instance solved it. https://github.com/oliyh/re-graph/?tab=readme-ov-file#multiple-instances

paola pereira 2025-03-06T14:49:02.141669Z

uhmmm will look at this! Thank you for the answer!

thogha 2024-12-10T20:22:54.902749Z

note rg = re-graph.core

p-himik 2024-12-10T20:24:33.182739Z

Just from that code block - no ideas. (BTW please use code blocks when formatting multiline code instead of inline code - can be done either with triple backticks or with a separate UI button in Slack.) Might be an issue with re-graph itself, might be something completely different in another part of your app. Try creating an MRE - chances are, you'll figure it out in the process. And if not, it will be easy for you to share the full problem and for us to find the culprit.

thogha 2024-12-10T20:26:24.500949Z

Ok, what's an MRE?

p-himik 2024-12-10T20:28:49.898869Z

Minimal Reproducible Example.

p-himik 2024-12-10T20:30:07.856509Z

In other words, something that can be checked out and launched with a command or two, and reproduces the error without any extra parts. Not a full app, not a piece of code that requires a lot of context or some config. It's StackOverflow terminology.

thogha 2024-12-10T20:30:40.239399Z

Got it