diff --git a/src/compiler/code_generator.ts b/src/compiler/code_generator.ts
index f3217687..db7918da 100644
--- a/src/compiler/code_generator.ts
+++ b/src/compiler/code_generator.ts
@@ -1181,7 +1181,9 @@ export class CodeGenerator {
id,
expr: `app.createComponent(${
ast.isDynamic ? null : expr
- }, ${!ast.isDynamic}, ${!!ast.slots}, ${!!ast.dynamicProps})`,
+ }, ${!ast.isDynamic}, ${!!ast.slots}, ${!!ast.dynamicProps}, ${
+ !ast.props && !ast.dynamicProps
+ })`,
});
let blockExpr = `${id}(${propString}, ${keyArg}, node, ctx, ${ast.isDynamic ? expr : null})`;
@@ -1278,7 +1280,7 @@ export class CodeGenerator {
let id = generateId("comp");
this.staticDefs.push({
id,
- expr: `app.createComponent(null, false, true, false)`,
+ expr: `app.createComponent(null, false, true, false, false)`,
});
const target = compileExpr(ast.target);
diff --git a/src/runtime/app.ts b/src/runtime/app.ts
index 311d2e74..c2974abf 100644
--- a/src/runtime/app.ts
+++ b/src/runtime/app.ts
@@ -118,7 +118,8 @@ export class App<
name: string | null,
isStatic: boolean,
hasSlotsProp: boolean,
- hasDynamicPropList: boolean
+ hasDynamicPropList: boolean,
+ hasNoProp: boolean
) {
const isDynamic = !isStatic;
function _arePropsDifferent(props1: Props, props2: Props): boolean {
@@ -129,7 +130,11 @@ export class App<
}
return hasDynamicPropList && Object.keys(props1).length !== Object.keys(props2).length;
}
- const arePropsDifferent = hasSlotsProp ? () => true : _arePropsDifferent;
+ const arePropsDifferent = hasSlotsProp
+ ? (_1: any, _2: any) => true
+ : hasNoProp
+ ? (_1: any, _2: any) => false
+ : _arePropsDifferent;
const updateAndRender = ComponentNode.prototype.updateAndRender;
const initiateRender = ComponentNode.prototype.initiateRender;
diff --git a/tests/__snapshots__/reactivity.test.ts.snap b/tests/__snapshots__/reactivity.test.ts.snap
index d9ca0e49..4a1e4872 100644
--- a/tests/__snapshots__/reactivity.test.ts.snap
+++ b/tests/__snapshots__/reactivity.test.ts.snap
@@ -50,7 +50,7 @@ exports[`Reactivity: useState destroyed component before being mounted is inacti
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
- const comp1 = app.createComponent(\`Child\`, true, false, false);
+ const comp1 = app.createComponent(\`Child\`, true, false, false, true);
let block1 = createBlock(\`
\`);
@@ -82,7 +82,7 @@ exports[`Reactivity: useState destroyed component is inactive 1`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
- const comp1 = app.createComponent(\`Child\`, true, false, false);
+ const comp1 = app.createComponent(\`Child\`, true, false, false, true);
let block1 = createBlock(\`
\`);
@@ -129,7 +129,7 @@ exports[`Reactivity: useState parent and children subscribed to same context 1`]
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
- const comp1 = app.createComponent(\`Child\`, true, false, false);
+ const comp1 = app.createComponent(\`Child\`, true, false, false, true);
let block1 = createBlock(\`
\`);
@@ -222,8 +222,8 @@ exports[`Reactivity: useState two components are updated in parallel 1`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
- const comp1 = app.createComponent(\`Child\`, true, false, false);
- const comp2 = app.createComponent(\`Child\`, true, false, false);
+ const comp1 = app.createComponent(\`Child\`, true, false, false, true);
+ const comp2 = app.createComponent(\`Child\`, true, false, false, true);
let block1 = createBlock(\`
\`);
@@ -253,8 +253,8 @@ exports[`Reactivity: useState two components can subscribe to same context 1`] =
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
- const comp1 = app.createComponent(\`Child\`, true, false, false);
- const comp2 = app.createComponent(\`Child\`, true, false, false);
+ const comp1 = app.createComponent(\`Child\`, true, false, false, true);
+ const comp2 = app.createComponent(\`Child\`, true, false, false, true);
let block1 = createBlock(\`
\`);
@@ -284,8 +284,8 @@ exports[`Reactivity: useState two independent components on different levels are
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
- const comp1 = app.createComponent(\`Child\`, true, false, false);
- const comp2 = app.createComponent(\`Parent\`, true, false, false);
+ const comp1 = app.createComponent(\`Child\`, true, false, false, true);
+ const comp2 = app.createComponent(\`Parent\`, true, false, false, true);
let block1 = createBlock(\`
\`);
@@ -315,7 +315,7 @@ exports[`Reactivity: useState two independent components on different levels are
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
- const comp1 = app.createComponent(\`Child\`, true, false, false);
+ const comp1 = app.createComponent(\`Child\`, true, false, false, true);
let block1 = createBlock(\`
\`);
@@ -345,7 +345,7 @@ exports[`Reactivity: useState useless atoms should be deleted 1`] = `
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { prepareList, withKey } = helpers;
- const comp1 = app.createComponent(\`Quantity\`, true, false, false);
+ const comp1 = app.createComponent(\`Quantity\`, true, false, false, false);
let block1 = createBlock(\` Total: Count:
\`);
diff --git a/tests/compiler/__snapshots__/misc.test.ts.snap b/tests/compiler/__snapshots__/misc.test.ts.snap
index d20f68a5..0d85de09 100644
--- a/tests/compiler/__snapshots__/misc.test.ts.snap
+++ b/tests/compiler/__snapshots__/misc.test.ts.snap
@@ -5,7 +5,7 @@ exports[`misc complex template 1`] = `
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { prepareList, withKey } = helpers;
- const comp1 = app.createComponent(\`SlotButton\`, true, false, false);
+ const comp1 = app.createComponent(\`SlotButton\`, true, false, false, false);
let block1 = createBlock(\`\`);
let block2 = createBlock(\`\`);
@@ -184,8 +184,8 @@ exports[`misc other complex template 1`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { prepareList, withKey } = helpers;
const callTemplate_1 = app.getTemplate(\`LOAD_INFOS_TEMPLATE\`);
- const comp1 = app.createComponent(\`BundlesList\`, true, false, false);
- const comp2 = app.createComponent(\`BundlesList\`, true, false, false);
+ const comp1 = app.createComponent(\`BundlesList\`, true, false, false, false);
+ const comp2 = app.createComponent(\`BundlesList\`, true, false, false, false);
let block1 = createBlock(\`