Thanks for the reply.

I wasn't able to reproduce it with a short snippet, although I hit this a
number of times over the past few days. Perhaps its more of a corner-case
than I thought. I will reproduce it over the weekend to see what the
smallest example that exhibits the behaviour is and I'll reply again then.

In the meantime, I'll stick with compoenent in my actual code.


On 3 April 2014 00:10, Creighton Kirkendall <[email protected]> wrote:

> Dan,
> It certainly should update the content here.  Can you post a full gist of
> that illustrates the issue and I will try to reproduce it.
>
> Creighton
>
>
> On Wed, Apr 2, 2014 at 6:32 PM, Daniel Kersten <[email protected]> wrote:
>
>> Hi,
>>
>> I've been playing with kioo and love it, but I'm a bit confused by
>> snippets (vs components). I took a look at the code and I can't quite
>> figure out how to use value-component (and therefore snippet) properly.
>>
>> Basically, if I have static content then snippet/defsnippet works fine,
>> but if I want to change this content later, then using snippet does not
>> properly update the components (I'm assuming because the "value" check in
>> should update in value-component does not pass?). Using component works in
>> this case.
>>
>> For example:
>>
>> test.html:
>> <div></div>
>>
>> (def list-item [app owner]
>>   (om/component
>>     (kioo/component "test.html" [:div]
>>         {[:div] (content app)})))
>>
>> (def list-component [app owner]
>>   (om/component
>>     (om/build-all list-item (:values app))))
>>
>> Where the state passe to list-component is {:values ["A" "B" "C" "D"]},
>> this outputs:
>> <div>A</div><div>B</div><div>C</div><div>D</div>
>>
>> Then changing the state to {:values ["X" "Y"]} outputs as expected:
>> <div>X</div><div>Y</div>
>>
>> However, if instead of kioo/component I use defsnippet, it does not work
>> as expected:
>>
>> (defsnippet list-item "test.html" [:div]
>>   [x]
>>   {[:div] (content x)})
>>
>> (def list-component [app owner]
>>   (om/component
>>     (map list-item (:values app))))
>>
>> With the same state, this outputs as expected:
>> <div>A</div><div>B</div><div>C</div><div>D</div>
>>
>> However, when changing the state to {:values ["X" "Y"]} it outputs:
>> <div>*A*</div><div>*B*</div>
>>
>> That is, it changes the number as expected, but does not change the
>> content.
>>
>> Can somebody explain why and what the expected way of using defsnippet
>> is? I can simply use kioo/component and everything works just fine, but I'd
>> like to understand more of kioo.
>>
>> Thanks,
>> Dan.
>>
>>  --
>> Note that posts from new members are moderated - please be patient with
>> your first post.
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "ClojureScript" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at http://groups.google.com/group/clojurescript.
>>
>
>  --
> Note that posts from new members are moderated - please be patient with
> your first post.
> ---
> You received this message because you are subscribed to the Google Groups
> "ClojureScript" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/clojurescript.
>

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to