This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-04-18
Channels
- # announcements (1)
- # babashka (16)
- # beginners (39)
- # calva (17)
- # cider (21)
- # cljs-dev (1)
- # clojars (2)
- # clojure (39)
- # clojure-australia (1)
- # clojure-europe (1)
- # clojure-spec (7)
- # conjure (1)
- # cursive (6)
- # datomic (2)
- # depstar (5)
- # graalvm (20)
- # instaparse (11)
- # meander (4)
- # pathom (4)
- # pedestal (3)
- # polylith (18)
- # re-frame (13)
- # reagent (4)
- # reitit (3)
- # shadow-cljs (2)
- # spacemacs (14)
- # vrac (1)
I'm trying to use Firebase with re-frame (no wrapper, just interop), and I have a problem with initializing Firebase. My idea was that I would use dispatch-sync to do so, but I am getting a (to me, at least) cryptic error message. "No protocol method IMap.-dissoc defined for type object: [object Object]". If I instead just call a function for initializing Firebase instead of going through dispatch-sync, I don't get an error.
You need to use reg-fx and write your own event handler. In reg-event-fx you need to dispatch to your new event handler.
An event handler registered with reg-event-fx
has to return a map of effects (or nil
, I think).
Whereas initialize-firebase
probably returns a Promise
.
You want to move the (initialize-firebase)
into an effect handler, and return a proper effect map from that event handler on your pic.
@U01NM475LKB You're mixing up event and effect handlers - those are different. Effects aren't dispatched, an effect map is simply returned from an event handler.
I obviously have some more reading to do. Thanks for putting me on the right course, p-himik.
@U01FJKR2SEA Also note that dispatch-sync
might not do something that dispatch
wouldn't do in this case because .initializeApp
is async. You cannot wait in the code till Firebase is initialized.
All you can do is use the proper Promise
API and schedule more work after Firebase is initialized.
We could probably assert that a reg-event-fx
fn returns map or nil
, and if not print a less cryptic error message. Maybe that would help those who hit this in the future ?