Open xPapay opened 2 years ago
This PR fixes the issue, when complex prop is lost on repeated connectedCallback call. It fixes it by saving all props into this._props.
The issue was that when complex prop was set as second or later prop (after vdom was created) we did not store it into this._props field. Then it is missing when connectedCallback is called implicitly (when element inserted into DOM), because we use there this._pros when rendering vdom; see: https://github.com/preactjs/preact-custom-element/blob/5790765ec0227ebb16add2f1469aef648e9f9f9e/src/index.js#L81
this._props
The simple props were not affected even if we set them as second or later prop because those are preserved in the attributes, and provided into vdom in connectedCallback, see: https://github.com/preactjs/preact-custom-element/blob/5790765ec0227ebb16add2f1469aef648e9f9f9e/src/index.js#L140
Fixes #69
Any chance to get this merged? It's very impractical to not be able to use complex properties normally.
This PR fixes the issue, when complex prop is lost on repeated connectedCallback call. It fixes it by saving all props into this._props.
The issue was that when complex prop was set as second or later prop (after vdom was created) we did not store it into
this._props
field. Then it is missing when connectedCallback is called implicitly (when element inserted into DOM), because we use there this._pros when rendering vdom; see: https://github.com/preactjs/preact-custom-element/blob/5790765ec0227ebb16add2f1469aef648e9f9f9e/src/index.js#L81The simple props were not affected even if we set them as second or later prop because those are preserved in the attributes, and provided into vdom in connectedCallback, see: https://github.com/preactjs/preact-custom-element/blob/5790765ec0227ebb16add2f1469aef648e9f9f9e/src/index.js#L140
Fixes #69