Skip to content

Commit 20c0460

Browse files
committed
refactor: Do not manually call connectedCallback
1 parent 986f340 commit 20c0460

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { h, cloneElement, render, hydrate } from 'preact';
44
* @typedef {import('./index.d.ts').PreactCustomElement} PreactCustomElement
55
*/
66

7-
87
/**
98
* @type {import('./index.d.ts').default}
109
*/
@@ -48,15 +47,16 @@ export default function register(Component, tagName, propNames, options) {
4847
propNames.forEach((name) => {
4948
Object.defineProperty(PreactElement.prototype, name, {
5049
get() {
51-
return this._vdom.props[name];
50+
return this._vdom
51+
? this._vdom.props[name]
52+
: this._props[name];
5253
},
5354
set(v) {
5455
if (this._vdom) {
5556
this.attributeChangedCallback(name, null, v);
5657
} else {
5758
if (!this._props) this._props = {};
5859
this._props[name] = v;
59-
this.connectedCallback();
6060
}
6161

6262
// Reflect property changes to attributes if the value is a primitive

0 commit comments

Comments
 (0)