On Thu, Mar 20, 2014 at 5:57 AM, Adrian Miron <adrian.miron...@gmail.com>wrote:
> > I'm starting to use om in some projects and one of the first components I > had to build was a simple notification component. It shows a message at the > top of the page. Other components in the page will use it to display > messages when errors happen. > > My idea was to send the message string to it via a channel and store it in > local state. From there it will be rendered by the component. > > The component doesn't use any application state so I build it with what I > believed to be a nil cursor (om/build notification *nil* {...}). The > problem is that when the component gets rendered I get a "No protocol > method ICursor.-path defined for type null" error. > If you don't pass app state data to this component then you don't need to bother with build at all. If you need a component that doesn't need app state but does need component local state you need to use om.core/graft. Refer to the documentation on om.core/graft and look at the examples in the repo. Channels could work. However :shared was also designed with this scenario in mind, you could use an atom with the message in it and placed it in :shared if the message is not an important piece of state for the rest of your application. There are also examples of :shared in the repo as well. HTH, David -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.