From b88494dede86d5f390dbbe9b7e31d72270e65ff3 Mon Sep 17 00:00:00 2001 From: Alex Kanunnikov Date: Wed, 27 Dec 2023 16:17:12 +0300 Subject: [PATCH] fix select issue --- .../benchmarks/krausest/lib/components/RowComponent.ts | 4 ++-- .../benchmarks/krausest/lib/components/TagComponent.ts | 4 ++-- benchmark/benchmarks/krausest/lib/utils/reactive.ts | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/benchmark/benchmarks/krausest/lib/components/RowComponent.ts b/benchmark/benchmarks/krausest/lib/components/RowComponent.ts index 7eb8dd8659..b7f2a620ac 100644 --- a/benchmark/benchmarks/krausest/lib/components/RowComponent.ts +++ b/benchmark/benchmarks/krausest/lib/components/RowComponent.ts @@ -4,7 +4,7 @@ import type { Application } from '@/components/Application'; import { TagComponent } from '@/components/TagComponent'; import { targetFor, type ComponentRenderTarget, type Destructors } from '@/utils/component'; import type { Item } from '@/utils/data'; -import { Cell, cellFor, formula } from '@/utils/reactive'; +import { cellFor, formula } from '@/utils/reactive'; // import { maybeUpdatingPropertyOpcode } from "@/utils/vm"; export function RowComponent( @@ -38,7 +38,7 @@ export function RowComponent( name: 'tr', className: formula(() => { return id === selectedCell.value ? 'danger' : ''; - }), + }, 'className'), // events: { // mouseenter: onMouseEnter, // mouseleave: onMouseLeave, diff --git a/benchmark/benchmarks/krausest/lib/components/TagComponent.ts b/benchmark/benchmarks/krausest/lib/components/TagComponent.ts index 8f1677d446..93a16edbaa 100644 --- a/benchmark/benchmarks/krausest/lib/components/TagComponent.ts +++ b/benchmark/benchmarks/krausest/lib/components/TagComponent.ts @@ -43,11 +43,11 @@ export function TagComponent( const slotNode = slot || document.createTextNode(''); - if (typeof className !== undefined) { + if (className !== undefined) { maybeUpdatingPropertyOpcode(destructors, element, 'className', className); } - if (typeof text !== undefined) { + if (text !== undefined) { maybeUpdatingPropertyOpcode(destructors, slotNode, 'textContent', text); } diff --git a/benchmark/benchmarks/krausest/lib/utils/reactive.ts b/benchmark/benchmarks/krausest/lib/utils/reactive.ts index f64c95db6f..acd3382a3b 100644 --- a/benchmark/benchmarks/krausest/lib/utils/reactive.ts +++ b/benchmark/benchmarks/krausest/lib/utils/reactive.ts @@ -87,7 +87,7 @@ export class MergedCell { if (this.isConst) { return this.fn(); } - if (null === currentTracker && !_isRendering) { + if (null === currentTracker && _isRendering) { currentTracker = tracker(); try { return this.fn(); @@ -139,6 +139,6 @@ export function cellFor(obj: T, key: K): Ce return cellValue; } -export function formula(fn: () => unknown) { - return new MergedCell(fn, 'formula'); +export function formula(fn: () => unknown, debugName?: string) { + return new MergedCell(fn, `formula:${debugName ?? 'unknown'}`); }