@absolutejs/absolute 0.19.0-beta.980 → 0.19.0-beta.982

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9457,9 +9457,24 @@ var useResource = (fetcher, options = {}) => {
9457
9457
  // src/angular/composables/useSubscription.ts
9458
9458
  import { DestroyRef as DestroyRef2, inject as inject3 } from "@angular/core";
9459
9459
  import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
9460
- function useSubscription(observable, observerOrNext) {
9461
- const destroyRef = inject3(DestroyRef2);
9462
- return observable.pipe(takeUntilDestroyed(destroyRef)).subscribe(typeof observerOrNext === "function" ? { next: observerOrNext } : observerOrNext);
9460
+ var warnedOnce = false;
9461
+ var tryCaptureDestroyRef = () => {
9462
+ try {
9463
+ return inject3(DestroyRef2);
9464
+ } catch {
9465
+ if (!warnedOnce) {
9466
+ warnedOnce = true;
9467
+ console.warn("[absolute/angular] useSubscription was called outside an Angular injection context (likely from a lifecycle hook). Auto-teardown via takeUntilDestroyed is disabled for that call; the subscription will leak unless the caller manually unsubscribes. Move the call to a field initializer or the constructor, or pass the captured DestroyRef as the third argument.");
9468
+ }
9469
+ return null;
9470
+ }
9471
+ };
9472
+ function useSubscription(observable, observerOrNext, destroyRef) {
9473
+ const captured = destroyRef ?? tryCaptureDestroyRef();
9474
+ const observer = typeof observerOrNext === "function" ? { next: observerOrNext } : observerOrNext;
9475
+ if (!captured)
9476
+ return observable.subscribe(observer);
9477
+ return observable.pipe(takeUntilDestroyed(captured)).subscribe(observer);
9463
9478
  }
9464
9479
  // src/angular/composables/useTimers.ts
9465
9480
  import { DestroyRef as DestroyRef3, inject as inject4 } from "@angular/core";
@@ -10355,5 +10370,5 @@ export {
10355
10370
  ABSOLUTE_HTTP_TRANSFER_CACHE_SKIP_HEADER
10356
10371
  };
10357
10372
 
10358
- //# debugId=CC85C04F779D102864756E2164756E21
10373
+ //# debugId=AF4A6CBC43E323FC64756E2164756E21
10359
10374
  //# sourceMappingURL=browser.js.map