luwes / swiss

🇨🇭Functional custom elements

Home Page:https://swiss.netlify.app/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to write more than element

WebReflection opened this issue · comments

I see you are augmenting only once the function in charge of rendering, but that's not quite how it works.

You cannot, as example, use two different <my-app> custom elements 'cause everything is hooked together.

Since you do have WeakMap in IE11 too, I suggest you initialize an augmented update per component.

const updates = new WeakMap;

// anywhere you can setup once the component
updates.set(this, augmentor(requestUpdate));

// instead of update.call(this)
updates.get(this).call(this);

This should probably be specified in the augmentor README, but basically you need to augment N times the same function per each consumer.

This is how other effects libraries works too.

Thanks for your feedback on this, greatly appreciated! Got the fix in.