zouhir / preact-habitat

Zero configuration Preact widgets renderer in any host DOM
MIT License
518 stars 43 forks source link

Passed props bleed to subsequent instances #24

Closed trurl-master closed 6 years ago

trurl-master commented 6 years ago

<div class="my-component">
    <script type="text/props">
        {"a": 1, "b": 2}
    </script>
</div>

<div class="my-component">
    <script type="text/props">
        {"a": 3}
    </script>
</div>

habitat(MyComponent).render({
    selector: '.my-component'
});

The second instance will receive {"a": 3, "b": 2}

If I understand correctly it is caused by directly mutating props in collectPropsFromElement

zouhir commented 6 years ago

oh shit.. I think you are right, that's a MUST fix real asap...

zouhir commented 6 years ago

I'll look at it next week, if you have time & can help happy to merge it earlier <3

sampotts commented 6 years ago

Did this PR get released? Seeing this myself at the moment...

zouhir commented 6 years ago

Releasing in the next few hours @sampotts!

sampotts commented 6 years ago

Thanks mate 👍

zouhir commented 6 years ago

I've just released 3.2.2 <3 thanks a lot for your patience!