reactronic 0.22.105 → 0.22.106

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.
@@ -12,7 +12,7 @@ export declare class Observable {
12
12
  get originSnapshotId(): number | undefined;
13
13
  constructor(value: any);
14
14
  }
15
- export declare type StandaloneMode = boolean | 'isolated';
15
+ export declare type StandaloneMode = boolean | 'isolated' | 'disposal';
16
16
  export interface Observer {
17
17
  readonly order: number;
18
18
  readonly observables: Map<Observable, ObservableInfo> | undefined;
@@ -39,7 +39,7 @@ export declare class Snapshot implements AbstractSnapshot {
39
39
  acquire(outer: Snapshot): void;
40
40
  bumpBy(timestamp: number): void;
41
41
  rebase(): ObjectRevision[] | undefined;
42
- private static merge;
42
+ private merge;
43
43
  applyOrDiscard(error?: any): Array<Observer>;
44
44
  static sealObjectRevision(h: ObjectHolder, r: ObjectRevision): void;
45
45
  static sealObservable(observable: Observable | symbol, m: MemberName, typeName: string): void;
@@ -130,7 +130,7 @@ class Snapshot {
130
130
  if (this.changeset.size > 0) {
131
131
  this.changeset.forEach((r, h) => {
132
132
  if (r.prev.revision !== h.head) {
133
- const merged = Snapshot.merge(h, r);
133
+ const merged = this.merge(h, r);
134
134
  if (r.conflicts.size > 0) {
135
135
  if (!conflicts)
136
136
  conflicts = [];
@@ -154,19 +154,21 @@ class Snapshot {
154
154
  }
155
155
  return conflicts;
156
156
  }
157
- static merge(h, ours) {
157
+ merge(h, ours) {
158
158
  let counter = 0;
159
159
  const head = h.head;
160
- const disposed = head.changes.has(Data_1.Meta.Disposed);
160
+ const headDisposed = head.changes.has(Data_1.Meta.Disposed);
161
161
  const merged = Object.assign({}, head.data);
162
162
  ours.changes.forEach((o, m) => {
163
163
  counter++;
164
164
  merged[m] = ours.data[m];
165
- if (disposed || m === Data_1.Meta.Disposed) {
166
- if (disposed !== (m === Data_1.Meta.Disposed)) {
167
- if (Dbg_1.Dbg.isOn && Dbg_1.Dbg.trace.change)
168
- Dbg_1.Dbg.log('║╠', '', `${Dump.rev2(h, ours.snapshot, m)} <> ${Dump.rev2(h, head.snapshot, m)}`, 0, ' *** CONFLICT ***');
169
- ours.conflicts.set(m, head);
165
+ if (headDisposed || m === Data_1.Meta.Disposed) {
166
+ if (headDisposed !== (m === Data_1.Meta.Disposed)) {
167
+ if (headDisposed || this.options.standalone !== 'disposal') {
168
+ if (Dbg_1.Dbg.isOn && Dbg_1.Dbg.trace.change)
169
+ Dbg_1.Dbg.log('║╠', '', `${Dump.rev2(h, ours.snapshot, m)} <> ${Dump.rev2(h, head.snapshot, m)}`, 0, ' *** CONFLICT ***');
170
+ ours.conflicts.set(m, head);
171
+ }
170
172
  }
171
173
  }
172
174
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reactronic",
3
- "version": "0.22.105",
3
+ "version": "0.22.106",
4
4
  "description": "Reactronic - Transactional Reactive State Management",
5
5
  "main": "build/dist/source/api.js",
6
6
  "types": "build/dist/source/api.d.ts",