@cascateer/core 2.0.15 → 2.0.17

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cascateer/core",
3
- "version": "2.0.15",
3
+ "version": "2.0.17",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/cascateer/core.git"
package/src/index.ts CHANGED
@@ -6,4 +6,4 @@ export { createElement, createFragment } from "./jsx-runtime";
6
6
  export { createSlice } from "./slice";
7
7
  export { type StoreEffect } from "./store";
8
8
  export { type TerminalEffect } from "./terminal";
9
- export { type Action, type Effect, type MaybeObservable } from "./types";
9
+ export { type Action, type MaybeObservable } from "./types";
@@ -2,10 +2,13 @@ import { MonoTypeOperatorFunction, NextObserver, tap } from "rxjs";
2
2
 
3
3
  export const tapSubscription =
4
4
  <T>(observer?: NextObserver<boolean>): MonoTypeOperatorFunction<T> =>
5
- (source) =>
6
- source.pipe(
5
+ (source) => {
6
+ let subscriptions = 0;
7
+
8
+ return source.pipe(
7
9
  tap({
8
- subscribe: () => observer?.next(true),
9
- unsubscribe: () => observer?.next(false),
10
+ subscribe: () => observer?.next(++subscriptions > 0),
11
+ unsubscribe: () => observer?.next(--subscriptions === 0),
10
12
  }),
11
13
  );
14
+ };