|
1 | | -import { clearStatus, handleAsync, notifyStatus, onlyMarkPending } from "./async.js"; |
| 1 | +import { clearStatus, handleAsync, notifyStatus } from "./async.js"; |
2 | 2 | import { |
3 | 3 | $REFRESH, |
4 | 4 | CONFIG_AUTO_DISPOSE, |
@@ -33,7 +33,6 @@ import { |
33 | 33 | type Refreshable |
34 | 34 | } from "./constants.js"; |
35 | 35 | import { NotReadyError } from "./error.js"; |
36 | | -import { externalSourceConfig } from "./external.js"; |
37 | 36 | import { link, trimStaleDeps, unobserved } from "./graph.js"; |
38 | 37 | import { |
39 | 38 | deleteFromHeap, |
@@ -556,17 +555,7 @@ function setupComputedNode<T>(self: Computed<T>, options: NodeOptions<T> | undef |
556 | 555 | } |
557 | 556 | if (__DEV__) DEV.hooks.onOwner?.(self); |
558 | 557 | if (parent) self._height = parent._height + 1; |
559 | | - if (externalSourceConfig) { |
560 | | - const bridgeSignal = signal<undefined>(undefined, { equals: false, ownedWrite: true }); |
561 | | - const source = externalSourceConfig.factory(self._fn as any, () => { |
562 | | - setSignal(bridgeSignal, undefined); |
563 | | - }); |
564 | | - cleanup(() => source.dispose()); |
565 | | - self._fn = ((prev: any) => { |
566 | | - read(bridgeSignal); |
567 | | - return source.track(prev); |
568 | | - }) as any; |
569 | | - } |
| 558 | + if (GlobalQueue._wireExternalSource !== null) GlobalQueue._wireExternalSource(self); |
570 | 559 | !options?.lazy && recompute(self, true); |
571 | 560 | if (snapshotCaptureActive && !options?.lazy) { |
572 | 561 | if (!(self._statusFlags & STATUS_PENDING) && !(self._config & CONFIG_NO_SNAPSHOT)) { |
@@ -670,14 +659,18 @@ export function setStrictRead(v: string | false): string | false { |
670 | 659 | * ``` |
671 | 660 | */ |
672 | 661 | export function untrack<T>(fn: () => T, strictReadLabel?: string | false): T { |
673 | | - if (!externalSourceConfig && !tracking && (!__DEV__ || (!strictRead && !strictReadLabel))) |
| 662 | + if ( |
| 663 | + GlobalQueue._externalUntrack === null && |
| 664 | + !tracking && |
| 665 | + (!__DEV__ || (!strictRead && !strictReadLabel)) |
| 666 | + ) |
674 | 667 | return fn(); |
675 | 668 | const prevTracking = tracking; |
676 | 669 | const prevStrictRead = strictRead; |
677 | 670 | tracking = false; |
678 | 671 | if (__DEV__) strictRead = strictReadLabel || false; |
679 | 672 | try { |
680 | | - if (externalSourceConfig) return externalSourceConfig.untrack(fn); |
| 673 | + if (GlobalQueue._externalUntrack !== null) return GlobalQueue._externalUntrack(fn); |
681 | 674 | return fn(); |
682 | 675 | } finally { |
683 | 676 | tracking = prevTracking; |
@@ -790,7 +783,7 @@ export function read<T>(el: Signal<T> | Computed<T>): T { |
790 | 783 | // sentinels can't survive in pending sources past their last release.) |
791 | 784 | if ( |
792 | 785 | owner._statusFlags & STATUS_PENDING && |
793 | | - !(activeAffectsMarks !== 0 && onlyMarkPending(owner as Computed<any>)) |
| 786 | + !(activeAffectsMarks !== 0 && GlobalQueue._onlyMarkPending!(owner as Computed<any>)) |
794 | 787 | ) { |
795 | 788 | if (c && !(stale && owner._transition && activeTransition !== owner._transition)) { |
796 | 789 | if (__DEV__ && c && c._config & CONFIG_CHILDREN_FORBIDDEN) { |
|
0 commit comments