Adrian Miron writes:
> 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.
>
> I'm not sure if my design of this component is ok (core.async channel to
> send messages and use of local state) or should I change it and remove the
> use of channels and put the message in the application state. I kinda like
> the channel approach :)
>
> Any ideas?
>
>
> Thank you,
> Adrian
My gut feeling tells me to put notifications into the application state:
They get conj'ed into a ::notifications or similar and the
event-view-component (or some other mechanism) removes old ones from the
list after a timeout or similar.
Your approach should be fine too - just give it a try. The simplest
solution to your problem is passing the whole application state to
`build' - the performance penalty on state-changes should be negligible
as long as React doesn't need to modify the DOM.
--
Moritz Ulrich
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/d/optout.