@@ -16,23 +16,27 @@ import {
1616 QScopedStyle ,
1717 NODE_PROPS_DATA_KEY ,
1818 NODE_DIFF_DATA_KEY ,
19+ HOST_SIGNAL ,
1920} from '../utils/markers' ;
2021import { addComponentStylePrefix } from '../utils/scoped-styles' ;
21- import { isPromise , retryOnPromise , safeCall } from '../utils/promises' ;
22+ import { isPromise , maybeThen , retryOnPromise , safeCall } from '../utils/promises' ;
2223import type { ValueOrPromise } from '../utils/types' ;
2324import type { Container , HostElement } from '../types' ;
2425import type { VNode } from '../vnode/vnode' ;
2526import { VNodeFlags , type ClientContainer } from '../../client/types' ;
2627import type { Cursor } from './cursor' ;
2728import type { NodeProp } from '../../reactive-primitives/subscription-data' ;
28- import { isSignal } from '../../reactive-primitives/utils' ;
29+ import { isSignal , scheduleEffects } from '../../reactive-primitives/utils' ;
2930import type { Signal } from '../../reactive-primitives/signal.public' ;
3031import { serializeAttribute } from '../utils/styles' ;
3132import type { ISsrNode , SSRContainer } from '../../ssr/ssr-types' ;
3233import type { ElementVNode } from '../vnode/element-vnode' ;
3334import { VNodeOperationType } from '../vnode/enums/vnode-operation-type.enum' ;
3435import type { JSXOutput } from '../jsx/types/jsx-node' ;
3536import { getAfterFlushTasks , setAfterFlushTasks , setExtraPromises } from './cursor-props' ;
37+ import { invoke , newInvokeContext } from '../../use/use-core' ;
38+ import type { WrappedSignalImpl } from '../../reactive-primitives/impl/wrapped-signal-impl' ;
39+ import { SignalFlags } from '../../reactive-primitives/types' ;
3640
3741/**
3842 * Executes tasks for a vNode if the TASKS dirty bit is set. Tasks are stored in the ELEMENT_SEQ
@@ -337,11 +341,24 @@ export function executeCleanup(vNode: VNode, container: Container): void {
337341 */
338342export function executeCompute ( vNode : VNode , container : Container ) : ValueOrPromise < void > {
339343 vNode . dirty &= ~ ChoreBits . COMPUTE ;
340-
341- // Compute chores are typically handled by the reactive system.
342- // This is a placeholder for explicit compute chores if needed.
343-
344- // TODO remove or use
345-
346- return ;
344+ const target = container . getHostProp < WrappedSignalImpl < unknown > | null > ( vNode , HOST_SIGNAL ) ;
345+ if ( ! target ) {
346+ return ;
347+ }
348+ const effects = target . $effects$ ;
349+
350+ const ctx = newInvokeContext ( ) ;
351+ ctx . $container$ = container ;
352+ // needed for computed signals and throwing QRLs
353+ return maybeThen (
354+ retryOnPromise ( ( ) =>
355+ invoke . call ( target , ctx , ( target as WrappedSignalImpl < unknown > ) . $computeIfNeeded$ )
356+ ) ,
357+ ( ) => {
358+ if ( ( target as WrappedSignalImpl < unknown > ) . $flags$ & SignalFlags . RUN_EFFECTS ) {
359+ ( target as WrappedSignalImpl < unknown > ) . $flags$ &= ~ SignalFlags . RUN_EFFECTS ;
360+ return scheduleEffects ( container , target , effects ) ;
361+ }
362+ }
363+ ) ;
347364}
0 commit comments