jeluard / hipo

A ClojureScript DOM templating library based on hiccup syntax
100 stars 9 forks source link

create for update - question #19

Closed davesann closed 9 years ago

davesann commented 9 years ago

Julien, I've been looking at your create for update capabilities. I have noted a couple of bugs, but I also have a larger question.

I can raise the bugs separately but quickly

Leaving that aside, there is a bigger question. The diff that you do is on the hiccup data produced by the render function. I think that the diff that react does is first on the input data - the props. IWillUpdate or something similar. in your case, from what I saw, I think that this means that the identical? checks that you do always fail because the hiccup data is always different. To really speed things up I think you need to be checking if the input data has changed, not so much the output hiccup data.

Thoughts?

Dave

jeluard commented 9 years ago

Please feel free to create bugs (even better with test and fix ;)) for the 2 first items!

I am not sure I understand your point about indexes. Can you detail?

Regarding your bigger question, my goal is to achieve what you describe (and more) thanks to some macro magic. Something similar is done for create but has yet to be done for the reconciliation part. You can find more details in this issue: #12. Also note I recently merged create and create-for-update so that you always provide a function with a payload to get the reconciliation function. I have to dig more into the behavior of identical? has it looks different between Clojure and ClojureScript. It might be irrelevant now.

Let me know what you think!

davesann commented 9 years ago

I'll raise and fix the bugs I noticed. I'll watch what you are doing on the rest.

jeluard commented 9 years ago

FYI I just fixed the key issue and it should now work as expected.