mobx 6.13.0 → 6.13.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # mobx
2
2
 
3
+ ## 6.13.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`f1f922152b45357a49ee6b310e9e0ecf38bd3955`](https://github.com/mobxjs/mobx/commit/f1f922152b45357a49ee6b310e9e0ecf38bd3955) [#3921](https://github.com/mobxjs/mobx/pull/3921) Thanks [@urugator](https://github.com/urugator)! - fix: #3919 new set methods not working with observable set
8
+
9
+ ## 6.13.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [`5e711e0b4737fd6b5b3c6f9b32afd4f195bc5fc3`](https://github.com/mobxjs/mobx/commit/5e711e0b4737fd6b5b3c6f9b32afd4f195bc5fc3) [#3901](https://github.com/mobxjs/mobx/pull/3901) Thanks [@peterm-canva](https://github.com/peterm-canva)! - Shrink Atom and Reaction using a bitfield
14
+
3
15
  ## 6.13.0
4
16
 
5
17
  ### Minor Changes
package/README.md CHANGED
@@ -55,8 +55,8 @@ MobX is made possible by the generosity of the sponsors below, and many other [i
55
55
  <a href="https://upper.co/?utm_source=github_mobxjs_sponsorship&utm_medium=paid_acquisition&utm_campaign=sponsorship"><img src="https://mobx.js.org/assets/upper.png" align="center" width="100" title="UPPER" alt="UPPER"/></a>
56
56
  <a href="https://careers.dazn.com/"><img src="https://mobx.js.org/assets/dazn.png" align="center" width="100" title="DAZN" alt="DAZN"></a>
57
57
  <a href="https://talentplot.com/"><img src="https://mobx.js.org/assets/talentplot.png" align="center" width="100" title="talentplot" alt="talentplot"></a>
58
-
59
- ## <a href="https://www.easeus.com/?utm_source=github_mobxjs_sponsorship&utm_medium=readme&utm_campaign=sponsorship"><img src="https://mobx.js.org/assets/easeus.png" align="center" width="100" title="EaseUS" alt="EaseUS"/></a>
58
+ <a href="https://www.easeus.com/?utm_source=github_mobxjs_sponsorship&utm_medium=readme&utm_campaign=sponsorship"><img src="https://mobx.js.org/assets/easeus.png" align="center" width="100" title="EaseUS" alt="EaseUS"/></a>
59
+ <a href="https://route4me.com/"><img src="https://mobx.js.org/assets/route4me.png" align="center" width="100" title="Route Planner and Route Optimizer" alt="Route Planner and Route Optimizer"/></a>
60
60
 
61
61
  ## Introduction
62
62
 
@@ -6,10 +6,11 @@ export interface IAtom extends IObservable {
6
6
  }
7
7
  export declare class Atom implements IAtom {
8
8
  name_: string;
9
- isPendingUnobservation: boolean;
10
- isBeingObserved: boolean;
9
+ private static readonly isBeingObservedMask_;
10
+ private static readonly isPendingUnobservationMask_;
11
+ private static readonly diffValueMask_;
12
+ private flags_;
11
13
  observers_: Set<IDerivation>;
12
- diffValue_: number;
13
14
  lastAccessedBy_: number;
14
15
  lowestObserverState_: IDerivationState_;
15
16
  /**
@@ -17,6 +18,12 @@ export declare class Atom implements IAtom {
17
18
  * The onBecomeObserved and onBecomeUnobserved callbacks can be used for resource management.
18
19
  */
19
20
  constructor(name_?: string);
21
+ get isBeingObserved(): boolean;
22
+ set isBeingObserved(newValue: boolean);
23
+ get isPendingUnobservation(): boolean;
24
+ set isPendingUnobservation(newValue: boolean);
25
+ get diffValue(): 0 | 1;
26
+ set diffValue(newValue: 0 | 1);
20
27
  onBOL: Set<Lambda> | undefined;
21
28
  onBUOL: Set<Lambda> | undefined;
22
29
  onBO(): void;
@@ -44,7 +44,6 @@ export declare class ComputedValue<T> implements IObservable, IComputedValue<T>,
44
44
  observing_: IObservable[];
45
45
  newObserving_: null;
46
46
  observers_: Set<IDerivation>;
47
- diffValue_: number;
48
47
  runId_: number;
49
48
  lastAccessedBy_: number;
50
49
  lowestObserverState_: IDerivationState_;
@@ -56,6 +55,7 @@ export declare class ComputedValue<T> implements IObservable, IComputedValue<T>,
56
55
  private static readonly isRunningSetterMask_;
57
56
  private static readonly isBeingObservedMask_;
58
57
  private static readonly isPendingUnobservationMask_;
58
+ private static readonly diffValueMask_;
59
59
  private flags_;
60
60
  derivation: () => T;
61
61
  setter_?: (value: T) => void;
@@ -90,6 +90,8 @@ export declare class ComputedValue<T> implements IObservable, IComputedValue<T>,
90
90
  set isBeingObserved(newValue: boolean);
91
91
  get isPendingUnobservation(): boolean;
92
92
  set isPendingUnobservation(newValue: boolean);
93
+ get diffValue(): 0 | 1;
94
+ set diffValue(newValue: 0 | 1);
93
95
  /**
94
96
  * Returns the current value of this computed value.
95
97
  * Will evaluate its computation first if needed.
@@ -4,7 +4,7 @@ export interface IDepTreeNode {
4
4
  observing_?: IObservable[];
5
5
  }
6
6
  export interface IObservable extends IDepTreeNode {
7
- diffValue_: number;
7
+ diffValue: number;
8
8
  /**
9
9
  * Id of the derivation *run* that last accessed this observable.
10
10
  * If this id equals the *run* id of the current derivation,
@@ -33,18 +33,28 @@ export declare class Reaction implements IDerivation, IReactionPublic {
33
33
  observing_: IObservable[];
34
34
  newObserving_: IObservable[];
35
35
  dependenciesState_: IDerivationState_;
36
- diffValue_: number;
37
36
  runId_: number;
38
37
  unboundDepsCount_: number;
39
- isDisposed_: boolean;
40
- isScheduled_: boolean;
41
- isTrackPending_: boolean;
42
- isRunning_: boolean;
38
+ private static readonly isDisposedMask_;
39
+ private static readonly isScheduledMask_;
40
+ private static readonly isTrackPendingMask_;
41
+ private static readonly isRunningMask_;
42
+ private static readonly diffValueMask_;
43
+ private flags_;
43
44
  isTracing_: TraceMode;
44
45
  constructor(name_: string, onInvalidate_: () => void, errorHandler_?: ((error: any, derivation: IDerivation) => void) | undefined, requiresObservable_?: any);
46
+ get isDisposed(): boolean;
47
+ set isDisposed(newValue: boolean);
48
+ get isScheduled(): boolean;
49
+ set isScheduled(newValue: boolean);
50
+ get isTrackPending(): boolean;
51
+ set isTrackPending(newValue: boolean);
52
+ get isRunning(): boolean;
53
+ set isRunning(newValue: boolean);
54
+ get diffValue(): 0 | 1;
55
+ set diffValue(newValue: 0 | 1);
45
56
  onBecomeStale_(): void;
46
57
  schedule_(): void;
47
- isScheduled(): boolean;
48
58
  /**
49
59
  * internal, use schedule() if you intend to kick off a reaction
50
60
  */
@@ -206,15 +206,24 @@ function createInstanceofPredicate(name, theClass) {
206
206
  return isObject(x) && x[propName] === true;
207
207
  };
208
208
  }
209
+ /**
210
+ * Yields true for both native and observable Map, even across different windows.
211
+ */
209
212
  function isES6Map(thing) {
210
213
  return thing != null && Object.prototype.toString.call(thing) === "[object Map]";
211
214
  }
215
+ /**
216
+ * Makes sure a Map is an instance of non-inherited native or observable Map.
217
+ */
212
218
  function isPlainES6Map(thing) {
213
219
  var mapProto = Object.getPrototypeOf(thing);
214
220
  var objectProto = Object.getPrototypeOf(mapProto);
215
221
  var nullProto = Object.getPrototypeOf(objectProto);
216
222
  return nullProto === null;
217
223
  }
224
+ /**
225
+ * Yields true for both native and observable Set, even across different windows.
226
+ */
218
227
  function isES6Set(thing) {
219
228
  return thing != null && Object.prototype.toString.call(thing) === "[object Set]";
220
229
  }
@@ -266,6 +275,17 @@ var getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || function get
266
275
  });
267
276
  return res;
268
277
  };
278
+ function getFlag(flags, mask) {
279
+ return !!(flags & mask);
280
+ }
281
+ function setFlag(flags, mask, newValue) {
282
+ if (newValue) {
283
+ flags |= mask;
284
+ } else {
285
+ flags &= ~mask;
286
+ }
287
+ return flags;
288
+ }
269
289
 
270
290
  function _arrayLikeToArray(r, a) {
271
291
  (null == a || a > r.length) && (a = r.length);
@@ -418,11 +438,8 @@ var Atom = /*#__PURE__*/function () {
418
438
  name_ = "Atom@" + getNextId() ;
419
439
  }
420
440
  this.name_ = void 0;
421
- this.isPendingUnobservation = false;
422
- // for effective unobserving. BaseAtom has true, for extra optimization, so its onBecomeUnobserved never gets called, because it's not needed
423
- this.isBeingObserved = false;
441
+ this.flags_ = 0;
424
442
  this.observers_ = new Set();
425
- this.diffValue_ = 0;
426
443
  this.lastAccessedBy_ = 0;
427
444
  this.lowestObserverState_ = IDerivationState_.NOT_TRACKING_;
428
445
  // onBecomeObservedListeners
@@ -431,6 +448,7 @@ var Atom = /*#__PURE__*/function () {
431
448
  this.onBUOL = void 0;
432
449
  this.name_ = name_;
433
450
  }
451
+ // for effective unobserving. BaseAtom has true, for extra optimization, so its onBecomeUnobserved never gets called, because it's not needed
434
452
  var _proto = Atom.prototype;
435
453
  _proto.onBO = function onBO() {
436
454
  if (this.onBOL) {
@@ -464,8 +482,35 @@ var Atom = /*#__PURE__*/function () {
464
482
  _proto.toString = function toString() {
465
483
  return this.name_;
466
484
  };
467
- return Atom;
485
+ return _createClass(Atom, [{
486
+ key: "isBeingObserved",
487
+ get: function get() {
488
+ return getFlag(this.flags_, Atom.isBeingObservedMask_);
489
+ },
490
+ set: function set(newValue) {
491
+ this.flags_ = setFlag(this.flags_, Atom.isBeingObservedMask_, newValue);
492
+ }
493
+ }, {
494
+ key: "isPendingUnobservation",
495
+ get: function get() {
496
+ return getFlag(this.flags_, Atom.isPendingUnobservationMask_);
497
+ },
498
+ set: function set(newValue) {
499
+ this.flags_ = setFlag(this.flags_, Atom.isPendingUnobservationMask_, newValue);
500
+ }
501
+ }, {
502
+ key: "diffValue",
503
+ get: function get() {
504
+ return getFlag(this.flags_, Atom.diffValueMask_) ? 1 : 0;
505
+ },
506
+ set: function set(newValue) {
507
+ this.flags_ = setFlag(this.flags_, Atom.diffValueMask_, newValue === 1 ? true : false);
508
+ }
509
+ }]);
468
510
  }();
511
+ Atom.isBeingObservedMask_ = 1;
512
+ Atom.isPendingUnobservationMask_ = 2;
513
+ Atom.diffValueMask_ = 4;
469
514
  var isAtom = /*#__PURE__*/createInstanceofPredicate("Atom", Atom);
470
515
  function createAtom(name, onBecomeObservedHandler, onBecomeUnobservedHandler) {
471
516
  if (onBecomeObservedHandler === void 0) {
@@ -1433,17 +1478,6 @@ var ObservableValue = /*#__PURE__*/function (_Atom) {
1433
1478
  }(Atom);
1434
1479
  var isObservableValue = /*#__PURE__*/createInstanceofPredicate("ObservableValue", ObservableValue);
1435
1480
 
1436
- function getFlag(flags, mask) {
1437
- return !!(flags & mask);
1438
- }
1439
- function setFlag(flags, mask, newValue) {
1440
- if (newValue) {
1441
- flags |= mask;
1442
- } else {
1443
- flags &= ~mask;
1444
- }
1445
- return flags;
1446
- }
1447
1481
  /**
1448
1482
  * A node in the state dependency root that observes other nodes, and can be observed itself.
1449
1483
  *
@@ -1483,7 +1517,6 @@ var ComputedValue = /*#__PURE__*/function () {
1483
1517
  this.newObserving_ = null;
1484
1518
  // during tracking it's an array with new observed observers
1485
1519
  this.observers_ = new Set();
1486
- this.diffValue_ = 0;
1487
1520
  this.runId_ = 0;
1488
1521
  this.lastAccessedBy_ = 0;
1489
1522
  this.lowestObserverState_ = IDerivationState_.UP_TO_DATE_;
@@ -1710,12 +1743,21 @@ var ComputedValue = /*#__PURE__*/function () {
1710
1743
  set: function set(newValue) {
1711
1744
  this.flags_ = setFlag(this.flags_, ComputedValue.isPendingUnobservationMask_, newValue);
1712
1745
  }
1746
+ }, {
1747
+ key: "diffValue",
1748
+ get: function get() {
1749
+ return getFlag(this.flags_, ComputedValue.diffValueMask_) ? 1 : 0;
1750
+ },
1751
+ set: function set(newValue) {
1752
+ this.flags_ = setFlag(this.flags_, ComputedValue.diffValueMask_, newValue === 1 ? true : false);
1753
+ }
1713
1754
  }]);
1714
1755
  }();
1715
1756
  ComputedValue.isComputingMask_ = 1;
1716
1757
  ComputedValue.isRunningSetterMask_ = 2;
1717
1758
  ComputedValue.isBeingObservedMask_ = 4;
1718
1759
  ComputedValue.isPendingUnobservationMask_ = 8;
1760
+ ComputedValue.diffValueMask_ = 16;
1719
1761
  var isComputedValue = /*#__PURE__*/createInstanceofPredicate("ComputedValue", ComputedValue);
1720
1762
 
1721
1763
  var IDerivationState_;
@@ -1884,8 +1926,8 @@ function bindDependencies(derivation) {
1884
1926
  l = derivation.unboundDepsCount_;
1885
1927
  for (var i = 0; i < l; i++) {
1886
1928
  var dep = observing[i];
1887
- if (dep.diffValue_ === 0) {
1888
- dep.diffValue_ = 1;
1929
+ if (dep.diffValue === 0) {
1930
+ dep.diffValue = 1;
1889
1931
  if (i0 !== i) {
1890
1932
  observing[i0] = dep;
1891
1933
  }
@@ -1905,18 +1947,18 @@ function bindDependencies(derivation) {
1905
1947
  l = prevObserving.length;
1906
1948
  while (l--) {
1907
1949
  var _dep = prevObserving[l];
1908
- if (_dep.diffValue_ === 0) {
1950
+ if (_dep.diffValue === 0) {
1909
1951
  removeObserver(_dep, derivation);
1910
1952
  }
1911
- _dep.diffValue_ = 0;
1953
+ _dep.diffValue = 0;
1912
1954
  }
1913
1955
  // Go through all new observables and check diffValue: (now it should be unique)
1914
1956
  // 0: it was set to 0 in last loop. don't need to do anything.
1915
1957
  // 1: it wasn't observed, let's observe it. set back to 0
1916
1958
  while (i0--) {
1917
1959
  var _dep2 = observing[i0];
1918
- if (_dep2.diffValue_ === 1) {
1919
- _dep2.diffValue_ = 0;
1960
+ if (_dep2.diffValue === 1) {
1961
+ _dep2.diffValue = 0;
1920
1962
  addObserver(_dep2, derivation);
1921
1963
  }
1922
1964
  }
@@ -2369,13 +2411,9 @@ var Reaction = /*#__PURE__*/function () {
2369
2411
  // nodes we are looking at. Our value depends on these nodes
2370
2412
  this.newObserving_ = [];
2371
2413
  this.dependenciesState_ = IDerivationState_.NOT_TRACKING_;
2372
- this.diffValue_ = 0;
2373
2414
  this.runId_ = 0;
2374
2415
  this.unboundDepsCount_ = 0;
2375
- this.isDisposed_ = false;
2376
- this.isScheduled_ = false;
2377
- this.isTrackPending_ = false;
2378
- this.isRunning_ = false;
2416
+ this.flags_ = 0;
2379
2417
  this.isTracing_ = TraceMode.NONE;
2380
2418
  this.name_ = name_;
2381
2419
  this.onInvalidate_ = onInvalidate_;
@@ -2387,29 +2425,26 @@ var Reaction = /*#__PURE__*/function () {
2387
2425
  this.schedule_();
2388
2426
  };
2389
2427
  _proto.schedule_ = function schedule_() {
2390
- if (!this.isScheduled_) {
2391
- this.isScheduled_ = true;
2428
+ if (!this.isScheduled) {
2429
+ this.isScheduled = true;
2392
2430
  globalState.pendingReactions.push(this);
2393
2431
  runReactions();
2394
2432
  }
2395
- };
2396
- _proto.isScheduled = function isScheduled() {
2397
- return this.isScheduled_;
2398
2433
  }
2399
2434
  /**
2400
2435
  * internal, use schedule() if you intend to kick off a reaction
2401
2436
  */;
2402
2437
  _proto.runReaction_ = function runReaction_() {
2403
- if (!this.isDisposed_) {
2438
+ if (!this.isDisposed) {
2404
2439
  startBatch();
2405
- this.isScheduled_ = false;
2440
+ this.isScheduled = false;
2406
2441
  var prev = globalState.trackingContext;
2407
2442
  globalState.trackingContext = this;
2408
2443
  if (shouldCompute(this)) {
2409
- this.isTrackPending_ = true;
2444
+ this.isTrackPending = true;
2410
2445
  try {
2411
2446
  this.onInvalidate_();
2412
- if ("development" !== "production" && this.isTrackPending_ && isSpyEnabled()) {
2447
+ if ("development" !== "production" && this.isTrackPending && isSpyEnabled()) {
2413
2448
  // onInvalidate didn't trigger track right away..
2414
2449
  spyReport({
2415
2450
  name: this.name_,
@@ -2425,7 +2460,7 @@ var Reaction = /*#__PURE__*/function () {
2425
2460
  }
2426
2461
  };
2427
2462
  _proto.track = function track(fn) {
2428
- if (this.isDisposed_) {
2463
+ if (this.isDisposed) {
2429
2464
  return;
2430
2465
  // console.warn("Reaction already disposed") // Note: Not a warning / error in mobx 4 either
2431
2466
  }
@@ -2439,14 +2474,14 @@ var Reaction = /*#__PURE__*/function () {
2439
2474
  type: "reaction"
2440
2475
  });
2441
2476
  }
2442
- this.isRunning_ = true;
2477
+ this.isRunning = true;
2443
2478
  var prevReaction = globalState.trackingContext; // reactions could create reactions...
2444
2479
  globalState.trackingContext = this;
2445
2480
  var result = trackDerivedFunction(this, fn, undefined);
2446
2481
  globalState.trackingContext = prevReaction;
2447
- this.isRunning_ = false;
2448
- this.isTrackPending_ = false;
2449
- if (this.isDisposed_) {
2482
+ this.isRunning = false;
2483
+ this.isTrackPending = false;
2484
+ if (this.isDisposed) {
2450
2485
  // disposed during last run. Clean up everything that was bound after the dispose call.
2451
2486
  clearObserving(this);
2452
2487
  }
@@ -2489,9 +2524,9 @@ var Reaction = /*#__PURE__*/function () {
2489
2524
  });
2490
2525
  };
2491
2526
  _proto.dispose = function dispose() {
2492
- if (!this.isDisposed_) {
2493
- this.isDisposed_ = true;
2494
- if (!this.isRunning_) {
2527
+ if (!this.isDisposed) {
2528
+ this.isDisposed = true;
2529
+ if (!this.isRunning) {
2495
2530
  // if disposed while running, clean up later. Maybe not optimal, but rare case
2496
2531
  startBatch();
2497
2532
  clearObserving(this);
@@ -2518,8 +2553,53 @@ var Reaction = /*#__PURE__*/function () {
2518
2553
  }
2519
2554
  trace(this, enterBreakPoint);
2520
2555
  };
2521
- return Reaction;
2556
+ return _createClass(Reaction, [{
2557
+ key: "isDisposed",
2558
+ get: function get() {
2559
+ return getFlag(this.flags_, Reaction.isDisposedMask_);
2560
+ },
2561
+ set: function set(newValue) {
2562
+ this.flags_ = setFlag(this.flags_, Reaction.isDisposedMask_, newValue);
2563
+ }
2564
+ }, {
2565
+ key: "isScheduled",
2566
+ get: function get() {
2567
+ return getFlag(this.flags_, Reaction.isScheduledMask_);
2568
+ },
2569
+ set: function set(newValue) {
2570
+ this.flags_ = setFlag(this.flags_, Reaction.isScheduledMask_, newValue);
2571
+ }
2572
+ }, {
2573
+ key: "isTrackPending",
2574
+ get: function get() {
2575
+ return getFlag(this.flags_, Reaction.isTrackPendingMask_);
2576
+ },
2577
+ set: function set(newValue) {
2578
+ this.flags_ = setFlag(this.flags_, Reaction.isTrackPendingMask_, newValue);
2579
+ }
2580
+ }, {
2581
+ key: "isRunning",
2582
+ get: function get() {
2583
+ return getFlag(this.flags_, Reaction.isRunningMask_);
2584
+ },
2585
+ set: function set(newValue) {
2586
+ this.flags_ = setFlag(this.flags_, Reaction.isRunningMask_, newValue);
2587
+ }
2588
+ }, {
2589
+ key: "diffValue",
2590
+ get: function get() {
2591
+ return getFlag(this.flags_, Reaction.diffValueMask_) ? 1 : 0;
2592
+ },
2593
+ set: function set(newValue) {
2594
+ this.flags_ = setFlag(this.flags_, Reaction.diffValueMask_, newValue === 1 ? true : false);
2595
+ }
2596
+ }]);
2522
2597
  }();
2598
+ Reaction.isDisposedMask_ = 1;
2599
+ Reaction.isScheduledMask_ = 2;
2600
+ Reaction.isTrackPendingMask_ = 4;
2601
+ Reaction.isRunningMask_ = 8;
2602
+ Reaction.diffValueMask_ = 16;
2523
2603
  function onReactionError(handler) {
2524
2604
  globalState.globalReactionErrorHandlers.push(handler);
2525
2605
  return function () {
@@ -2713,7 +2793,7 @@ function autorun(view, opts) {
2713
2793
  isScheduled = true;
2714
2794
  scheduler(function () {
2715
2795
  isScheduled = false;
2716
- if (!reaction.isDisposed_) {
2796
+ if (!reaction.isDisposed) {
2717
2797
  reaction.track(reactionRunner);
2718
2798
  }
2719
2799
  });
@@ -2767,7 +2847,7 @@ function reaction(expression, effect, opts) {
2767
2847
  }, opts.onError, opts.requiresObservable);
2768
2848
  function reactionRunner() {
2769
2849
  isScheduled = false;
2770
- if (r.isDisposed_) {
2850
+ if (r.isDisposed) {
2771
2851
  return;
2772
2852
  }
2773
2853
  var changed = false;
@@ -3394,7 +3474,7 @@ function _when(predicate, effect, opts) {
3394
3474
  if (typeof opts.timeout === "number") {
3395
3475
  var error = new Error("WHEN_TIMEOUT");
3396
3476
  timeoutHandle = setTimeout(function () {
3397
- if (!disposer[$mobx].isDisposed_) {
3477
+ if (!disposer[$mobx].isDisposed) {
3398
3478
  disposer();
3399
3479
  if (opts.onError) {
3400
3480
  opts.onError(error);
@@ -4700,7 +4780,7 @@ var ObservableSet = /*#__PURE__*/function () {
4700
4780
  });
4701
4781
  };
4702
4782
  _proto.intersection = function intersection(otherSet) {
4703
- if (isES6Set(otherSet)) {
4783
+ if (isES6Set(otherSet) && !isObservableSet(otherSet)) {
4704
4784
  return otherSet.intersection(this);
4705
4785
  } else {
4706
4786
  var dehancedSet = new Set(this);
@@ -4708,7 +4788,7 @@ var ObservableSet = /*#__PURE__*/function () {
4708
4788
  }
4709
4789
  };
4710
4790
  _proto.union = function union(otherSet) {
4711
- if (isES6Set(otherSet)) {
4791
+ if (isES6Set(otherSet) && !isObservableSet(otherSet)) {
4712
4792
  return otherSet.union(this);
4713
4793
  } else {
4714
4794
  var dehancedSet = new Set(this);
@@ -4719,7 +4799,7 @@ var ObservableSet = /*#__PURE__*/function () {
4719
4799
  return new Set(this).difference(otherSet);
4720
4800
  };
4721
4801
  _proto.symmetricDifference = function symmetricDifference(otherSet) {
4722
- if (isES6Set(otherSet)) {
4802
+ if (isES6Set(otherSet) && !isObservableSet(otherSet)) {
4723
4803
  return otherSet.symmetricDifference(this);
4724
4804
  } else {
4725
4805
  var dehancedSet = new Set(this);
@@ -4733,7 +4813,7 @@ var ObservableSet = /*#__PURE__*/function () {
4733
4813
  return new Set(this).isSupersetOf(otherSet);
4734
4814
  };
4735
4815
  _proto.isDisjointFrom = function isDisjointFrom(otherSet) {
4736
- if (isES6Set(otherSet)) {
4816
+ if (isES6Set(otherSet) && !isObservableSet(otherSet)) {
4737
4817
  return otherSet.isDisjointFrom(this);
4738
4818
  } else {
4739
4819
  var dehancedSet = new Set(this);