feat: rebuild reactivity state from store after replay
Add `rebuildReactivityFromStore` to synchronize local reactivity state with the hydrated variable store. This ensures tag activations are correctly tracked following a reducer replay. Also remove the unused `invalidateCompletions` function.
This commit is contained in:
@@ -167,6 +167,27 @@ export function setBase(key: string, value: string): void {
|
||||
baseValues.set(key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rebuild local reactivity state (baseValues, activeMods, sourceActivations)
|
||||
* from the hydrated stream variable store. Must be called after replayReducers
|
||||
* so that tag activations are correctly tracked for subsequent cascade
|
||||
* computations.
|
||||
*/
|
||||
export function rebuildReactivityFromStore(variables: VariableStore): void {
|
||||
if (!tagModMap) return;
|
||||
|
||||
for (const [key, value] of Object.entries(variables)) {
|
||||
if (!baseValues.has(key)) {
|
||||
baseValues.set(key, value);
|
||||
}
|
||||
|
||||
const tag = isTagValue(value);
|
||||
if (tag && !sourceActivations.has(key)) {
|
||||
activateTagFromSource(key, tag, variables);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute cascade effects after a variable change.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user