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?
hey @tom.ghali! How are you? I am with the same problem here, but with a intermittent behavior. Did you find out the cause?
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
uhmmm will look at this! Thank you for the answer!
note rg = re-graph.core
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.
Ok, what's an MRE?
Minimal Reproducible Example.
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.
Got it