choojs / choo

:steam_locomotive::train: - sturdy 4kb frontend framework
https://choo.io/
MIT License
6.78k stars 595 forks source link

option to ignore subtree render #338

Closed xz64 closed 7 years ago

xz64 commented 7 years ago

Hi,

Thanks for creating this framework. I am trying to see how feasible it is to integrate a jquery library such as selectize into this framework. It seemed to work ok until the DOM gets morphed. At that point all the selectize initialization is lost. It would be nice if we could have a way to skip a subtree when diffing the dom. It looks like morphdom (and yo-yo with some additional configuration) already support this by passing a onBeforeElChildrenUpdated function. I'm open to other ideas on how to approach this issue.

Expected behavior

The select element should not get un-selectized after checking the checkbox.

Actual behavior

Select element get un-selectized after checking the box

Steps to reproduce behavior

See on codepen: http://codepen.io/xz64/pen/dOvgEg

yoshuawuyts commented 7 years ago

Try giving cache-element/widget a shot https://github.com/yoshuawuyts/cache-element

On Wed, Nov 23, 2016 at 3:26 PM S K notifications@github.com wrote:

Hi,

Thanks for creating this framework. I am trying to see how feasible it is to integrate a jquery library such as selectize into this framework. It seemed to work ok until the DOM gets morphed. At that point all the selectize initialization is lost. It would be nice if we could have a way to skip a subtree when diffing the dom. It looks like morphdom (and yo-yo with some additional configuration) already support this by passing a onBeforeElChildrenUpdated https://github.com/patrick-steele-idem/morphdom#api function. I'm open to other ideas on how to approach this issue. Expected behavior

The select element should not get un-selectized after checking the checkbox. Actual behavior

Select element get un-selectized after checking the box Steps to reproduce behavior

See on codepen: http://codepen.io/xz64/pen/dOvgEg

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/yoshuawuyts/choo/issues/338, or mute the thread https://github.com/notifications/unsubscribe-auth/ACWlepsPIErYqnNNL34fabOYciUOhT5cks5rBEz-gaJpZM4K6otX .

aknuds1 commented 7 years ago

Interesting, I was just about to ask about this sort of thing, in conjunction with the D3.js library, which also manages its own subtree. I hope cache-element turns out to be the solution!

xz64 commented 7 years ago

Thanks @yoshuawuyts , this seemed to work. I just wrapped my selectize component with the cache-element/widget function.

The choo-leaflet-demo repo was helpful in showing how to use cache-element.

yoshuawuyts commented 7 years ago

Yay glad!

On Thu, Nov 24, 2016, 19:05 S K notifications@github.com wrote:

Thanks @yoshuawuyts https://github.com/yoshuawuyts , this seemed to work. I just wrapped my selectize component with the cache-element/widget function.

The choo-leaflet-demo https://github.com/timwis/choo-leaflet-demo repo was helpful in showing how to use cache-element.

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/yoshuawuyts/choo/issues/338#issuecomment-262826814, or mute the thread https://github.com/notifications/unsubscribe-auth/ACWleqEVbaS4vdCvZjrZVTxA70ThDR8Oks5rBdH4gaJpZM4K6otX .

siuying commented 7 years ago

I had same issue but new cache-element do not have widget... i have read the few commits and nanocomponents but its not clear how I can use the new api to wrap third party widget?