From f4fc5f17a78b10b7dfc2b783c40e094ade06bf24 Mon Sep 17 00:00:00 2001 From: alex Date: Thu, 25 Apr 2024 13:31:05 +0100 Subject: [PATCH] Revert "[signia] Smart dirty checking of active computeds (#3516)" This reverts commit 741ed00bda22f3b445f5996a40ce4bd54a629cc6. --- packages/state/src/lib/core/Computed.ts | 13 +++---------- packages/state/src/lib/core/transactions.ts | 4 ---- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/packages/state/src/lib/core/Computed.ts b/packages/state/src/lib/core/Computed.ts index 2d82490d6..290f8c97d 100644 --- a/packages/state/src/lib/core/Computed.ts +++ b/packages/state/src/lib/core/Computed.ts @@ -4,7 +4,7 @@ import { HistoryBuffer } from './HistoryBuffer' import { maybeCaptureParent, startCapturingParents, stopCapturingParents } from './capture' import { GLOBAL_START_EPOCH } from './constants' import { EMPTY_ARRAY, equals, haveParentsChanged, singleton } from './helpers' -import { getGlobalEpoch, getIsReacting } from './transactions' +import { getGlobalEpoch } from './transactions' import { Child, ComputeDiff, RESET_VALUE, Signal } from './types' import { logComputedGetterWarning } from './warnings' @@ -189,15 +189,8 @@ class __UNSAFE__Computed implements Computed __unsafe__getWithoutCapture(ignoreErrors?: boolean): Value { const isNew = this.lastChangedEpoch === GLOBAL_START_EPOCH - const globalEpoch = getGlobalEpoch() - - if ( - !isNew && - (this.lastCheckedEpoch === globalEpoch || - (this.isActivelyListening && getIsReacting() && this.lastTraversedEpoch < globalEpoch) || - !haveParentsChanged(this)) - ) { - this.lastCheckedEpoch = globalEpoch + if (!isNew && (this.lastCheckedEpoch === getGlobalEpoch() || !haveParentsChanged(this))) { + this.lastCheckedEpoch = getGlobalEpoch() if (this.error) { if (!ignoreErrors) { throw this.error.thrownValue diff --git a/packages/state/src/lib/core/transactions.ts b/packages/state/src/lib/core/transactions.ts index 0e3672eee..afb92d7d1 100644 --- a/packages/state/src/lib/core/transactions.ts +++ b/packages/state/src/lib/core/transactions.ts @@ -70,10 +70,6 @@ export function getGlobalEpoch() { return inst.globalEpoch } -export function getIsReacting() { - return inst.globalIsReacting -} - /** * Collect all of the reactors that need to run for an atom and run them. *