@cratis/arc 20.28.0 → 20.33.1
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/dist/cjs/queries/ObservableQueryDiagnostics.d.ts.map +1 -1
- package/dist/cjs/queries/ObservableQueryDiagnostics.js +0 -3
- package/dist/cjs/queries/ObservableQueryDiagnostics.js.map +1 -1
- package/dist/esm/queries/ObservableQueryDiagnostics.d.ts.map +1 -1
- package/dist/esm/queries/ObservableQueryDiagnostics.js +0 -3
- package/dist/esm/queries/ObservableQueryDiagnostics.js.map +1 -1
- package/dist/esm/queries/for_ObservableQueryDiagnostics/when_tracking_owners.js +16 -0
- package/dist/esm/queries/for_ObservableQueryDiagnostics/when_tracking_owners.js.map +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/queries/ObservableQueryDiagnostics.ts +0 -4
- package/queries/for_ObservableQueryDiagnostics/when_tracking_owners.ts +25 -0
package/package.json
CHANGED
|
@@ -118,10 +118,6 @@ export class ObservableQueryDiagnostics implements IObservableQueryDiagnostics {
|
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
private _publishSnapshot(snapshot: ObservableQueryDiagnosticsSnapshot): void {
|
|
121
|
-
if (typeof window !== 'undefined') {
|
|
122
|
-
window.dispatchEvent(new CustomEvent('cratis:observable-query-diagnostics', { detail: snapshot }));
|
|
123
|
-
}
|
|
124
|
-
|
|
125
121
|
this._snapshots.next(snapshot);
|
|
126
122
|
}
|
|
127
123
|
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
1
4
|
import { describe, it } from 'vitest';
|
|
2
5
|
import { ObservableQueryDiagnostics, QueryInstanceCache } from '../../queries';
|
|
3
6
|
|
|
@@ -21,4 +24,26 @@ describe('when tracking query owners', () => {
|
|
|
21
24
|
snapshots.should.have.lengthOf(2);
|
|
22
25
|
snapshots[1].should.equal('{"ownersByQueryKey":{},"queriesByOwner":{}}');
|
|
23
26
|
});
|
|
27
|
+
|
|
28
|
+
it('should not dispatch browser events when publishing snapshots', () => {
|
|
29
|
+
const diagnostics = new ObservableQueryDiagnostics(
|
|
30
|
+
new QueryInstanceCache(0),
|
|
31
|
+
() => undefined,
|
|
32
|
+
() => ({ queryTransportMethod: 'ServerSentEvents', queryDirectMode: false })
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
const globalWithWindow = globalThis as Record<string, unknown>;
|
|
36
|
+
const originalWindow = globalWithWindow.window;
|
|
37
|
+
const dispatchEvent = function(): never {
|
|
38
|
+
throw new Error('dispatchEvent should not be called');
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
try {
|
|
42
|
+
globalWithWindow.window = { dispatchEvent };
|
|
43
|
+
diagnostics.beginTracking('cache-key', 'OrdersPage');
|
|
44
|
+
diagnostics.endTracking('cache-key');
|
|
45
|
+
} finally {
|
|
46
|
+
globalWithWindow.window = originalWindow;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
24
49
|
});
|