@tanstack/query-broadcast-client-experimental 5.0.0-alpha.85 → 5.0.0-alpha.87
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/build/legacy/index.cjs +95 -0
- package/build/legacy/index.cjs.map +1 -0
- package/build/legacy/index.d.cts +9 -0
- package/build/legacy/index.d.ts +9 -0
- package/build/{lib/index.legacy.js → legacy/index.js} +26 -31
- package/build/legacy/index.js.map +1 -0
- package/build/modern/index.cjs +95 -0
- package/build/modern/index.cjs.map +1 -0
- package/build/modern/index.d.cts +9 -0
- package/build/modern/index.d.ts +9 -0
- package/build/{lib → modern}/index.js +25 -30
- package/build/modern/index.js.map +1 -0
- package/package.json +16 -14
- package/build/lib/index.cjs +0 -78
- package/build/lib/index.cjs.map +0 -1
- package/build/lib/index.d.ts +0 -8
- package/build/lib/index.d.ts.map +0 -1
- package/build/lib/index.js.map +0 -1
- package/build/lib/index.legacy.cjs +0 -78
- package/build/lib/index.legacy.cjs.map +0 -1
- package/build/lib/index.legacy.js.map +0 -1
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var src_exports = {};
|
|
20
|
+
__export(src_exports, {
|
|
21
|
+
broadcastQueryClient: () => broadcastQueryClient
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(src_exports);
|
|
24
|
+
var import_broadcast_channel = require("broadcast-channel");
|
|
25
|
+
function broadcastQueryClient({
|
|
26
|
+
queryClient,
|
|
27
|
+
broadcastChannel = "tanstack-query"
|
|
28
|
+
}) {
|
|
29
|
+
let transaction = false;
|
|
30
|
+
const tx = (cb) => {
|
|
31
|
+
transaction = true;
|
|
32
|
+
cb();
|
|
33
|
+
transaction = false;
|
|
34
|
+
};
|
|
35
|
+
const channel = new import_broadcast_channel.BroadcastChannel(broadcastChannel, {
|
|
36
|
+
webWorkerSupport: false
|
|
37
|
+
});
|
|
38
|
+
const queryCache = queryClient.getQueryCache();
|
|
39
|
+
queryClient.getQueryCache().subscribe((queryEvent) => {
|
|
40
|
+
if (transaction) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const {
|
|
44
|
+
query: { queryHash, queryKey, state }
|
|
45
|
+
} = queryEvent;
|
|
46
|
+
if (queryEvent.type === "updated" && queryEvent.action.type === "success") {
|
|
47
|
+
channel.postMessage({
|
|
48
|
+
type: "updated",
|
|
49
|
+
queryHash,
|
|
50
|
+
queryKey,
|
|
51
|
+
state
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
if (queryEvent.type === "removed") {
|
|
55
|
+
channel.postMessage({
|
|
56
|
+
type: "removed",
|
|
57
|
+
queryHash,
|
|
58
|
+
queryKey
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
channel.onmessage = (action) => {
|
|
63
|
+
if (!(action == null ? void 0 : action.type)) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
tx(() => {
|
|
67
|
+
const { type, queryHash, queryKey, state } = action;
|
|
68
|
+
if (type === "updated") {
|
|
69
|
+
const query = queryCache.get(queryHash);
|
|
70
|
+
if (query) {
|
|
71
|
+
query.setState(state);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
queryCache.build(
|
|
75
|
+
queryClient,
|
|
76
|
+
{
|
|
77
|
+
queryKey,
|
|
78
|
+
queryHash
|
|
79
|
+
},
|
|
80
|
+
state
|
|
81
|
+
);
|
|
82
|
+
} else if (type === "removed") {
|
|
83
|
+
const query = queryCache.get(queryHash);
|
|
84
|
+
if (query) {
|
|
85
|
+
queryCache.remove(query);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
92
|
+
0 && (module.exports = {
|
|
93
|
+
broadcastQueryClient
|
|
94
|
+
});
|
|
95
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import { BroadcastChannel } from 'broadcast-channel'\nimport type { QueryClient } from '@tanstack/query-core'\n\ninterface BroadcastQueryClientOptions {\n queryClient: QueryClient\n broadcastChannel?: string\n}\n\nexport function broadcastQueryClient({\n queryClient,\n broadcastChannel = 'tanstack-query',\n}: BroadcastQueryClientOptions) {\n let transaction = false\n const tx = (cb: () => void) => {\n transaction = true\n cb()\n transaction = false\n }\n\n const channel = new BroadcastChannel(broadcastChannel, {\n webWorkerSupport: false,\n })\n\n const queryCache = queryClient.getQueryCache()\n\n queryClient.getQueryCache().subscribe((queryEvent) => {\n if (transaction) {\n return\n }\n\n const {\n query: { queryHash, queryKey, state },\n } = queryEvent\n\n if (queryEvent.type === 'updated' && queryEvent.action.type === 'success') {\n channel.postMessage({\n type: 'updated',\n queryHash,\n queryKey,\n state,\n })\n }\n\n if (queryEvent.type === 'removed') {\n channel.postMessage({\n type: 'removed',\n queryHash,\n queryKey,\n })\n }\n })\n\n channel.onmessage = (action) => {\n if (!action?.type) {\n return\n }\n\n tx(() => {\n const { type, queryHash, queryKey, state } = action\n\n if (type === 'updated') {\n const query = queryCache.get(queryHash)\n\n if (query) {\n query.setState(state)\n return\n }\n\n queryCache.build(\n queryClient,\n {\n queryKey,\n queryHash,\n },\n state,\n )\n } else if (type === 'removed') {\n const query = queryCache.get(queryHash)\n\n if (query) {\n queryCache.remove(query)\n }\n }\n })\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,+BAAiC;AAQ1B,SAAS,qBAAqB;AAAA,EACnC;AAAA,EACA,mBAAmB;AACrB,GAAgC;AAC9B,MAAI,cAAc;AAClB,QAAM,KAAK,CAAC,OAAmB;AAC7B,kBAAc;AACd,OAAG;AACH,kBAAc;AAAA,EAChB;AAEA,QAAM,UAAU,IAAI,0CAAiB,kBAAkB;AAAA,IACrD,kBAAkB;AAAA,EACpB,CAAC;AAED,QAAM,aAAa,YAAY,cAAc;AAE7C,cAAY,cAAc,EAAE,UAAU,CAAC,eAAe;AACpD,QAAI,aAAa;AACf;AAAA,IACF;AAEA,UAAM;AAAA,MACJ,OAAO,EAAE,WAAW,UAAU,MAAM;AAAA,IACtC,IAAI;AAEJ,QAAI,WAAW,SAAS,aAAa,WAAW,OAAO,SAAS,WAAW;AACzE,cAAQ,YAAY;AAAA,QAClB,MAAM;AAAA,QACN;AAAA,QACA;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH;AAEA,QAAI,WAAW,SAAS,WAAW;AACjC,cAAQ,YAAY;AAAA,QAClB,MAAM;AAAA,QACN;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF,CAAC;AAED,UAAQ,YAAY,CAAC,WAAW;AAC9B,QAAI,EAAC,iCAAQ,OAAM;AACjB;AAAA,IACF;AAEA,OAAG,MAAM;AACP,YAAM,EAAE,MAAM,WAAW,UAAU,MAAM,IAAI;AAE7C,UAAI,SAAS,WAAW;AACtB,cAAM,QAAQ,WAAW,IAAI,SAAS;AAEtC,YAAI,OAAO;AACT,gBAAM,SAAS,KAAK;AACpB;AAAA,QACF;AAEA,mBAAW;AAAA,UACT;AAAA,UACA;AAAA,YACE;AAAA,YACA;AAAA,UACF;AAAA,UACA;AAAA,QACF;AAAA,MACF,WAAW,SAAS,WAAW;AAC7B,cAAM,QAAQ,WAAW,IAAI,SAAS;AAEtC,YAAI,OAAO;AACT,qBAAW,OAAO,KAAK;AAAA,QACzB;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACH;AACF;","names":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { QueryClient } from '@tanstack/query-core';
|
|
2
|
+
|
|
3
|
+
interface BroadcastQueryClientOptions {
|
|
4
|
+
queryClient: QueryClient;
|
|
5
|
+
broadcastChannel?: string;
|
|
6
|
+
}
|
|
7
|
+
declare function broadcastQueryClient({ queryClient, broadcastChannel, }: BroadcastQueryClientOptions): void;
|
|
8
|
+
|
|
9
|
+
export { broadcastQueryClient };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { QueryClient } from '@tanstack/query-core';
|
|
2
|
+
|
|
3
|
+
interface BroadcastQueryClientOptions {
|
|
4
|
+
queryClient: QueryClient;
|
|
5
|
+
broadcastChannel?: string;
|
|
6
|
+
}
|
|
7
|
+
declare function broadcastQueryClient({ queryClient, broadcastChannel, }: BroadcastQueryClientOptions): void;
|
|
8
|
+
|
|
9
|
+
export { broadcastQueryClient };
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { BroadcastChannel } from
|
|
2
|
-
|
|
1
|
+
import { BroadcastChannel } from "broadcast-channel";
|
|
3
2
|
function broadcastQueryClient({
|
|
4
3
|
queryClient,
|
|
5
|
-
broadcastChannel =
|
|
4
|
+
broadcastChannel = "tanstack-query"
|
|
6
5
|
}) {
|
|
7
6
|
let transaction = false;
|
|
8
|
-
const tx = cb => {
|
|
7
|
+
const tx = (cb) => {
|
|
9
8
|
transaction = true;
|
|
10
9
|
cb();
|
|
11
10
|
transaction = false;
|
|
@@ -14,55 +13,50 @@ function broadcastQueryClient({
|
|
|
14
13
|
webWorkerSupport: false
|
|
15
14
|
});
|
|
16
15
|
const queryCache = queryClient.getQueryCache();
|
|
17
|
-
queryClient.getQueryCache().subscribe(queryEvent => {
|
|
16
|
+
queryClient.getQueryCache().subscribe((queryEvent) => {
|
|
18
17
|
if (transaction) {
|
|
19
18
|
return;
|
|
20
19
|
}
|
|
21
20
|
const {
|
|
22
|
-
query: {
|
|
23
|
-
queryHash,
|
|
24
|
-
queryKey,
|
|
25
|
-
state
|
|
26
|
-
}
|
|
21
|
+
query: { queryHash, queryKey, state }
|
|
27
22
|
} = queryEvent;
|
|
28
|
-
if (queryEvent.type ===
|
|
23
|
+
if (queryEvent.type === "updated" && queryEvent.action.type === "success") {
|
|
29
24
|
channel.postMessage({
|
|
30
|
-
type:
|
|
25
|
+
type: "updated",
|
|
31
26
|
queryHash,
|
|
32
27
|
queryKey,
|
|
33
28
|
state
|
|
34
29
|
});
|
|
35
30
|
}
|
|
36
|
-
if (queryEvent.type ===
|
|
31
|
+
if (queryEvent.type === "removed") {
|
|
37
32
|
channel.postMessage({
|
|
38
|
-
type:
|
|
33
|
+
type: "removed",
|
|
39
34
|
queryHash,
|
|
40
35
|
queryKey
|
|
41
36
|
});
|
|
42
37
|
}
|
|
43
38
|
});
|
|
44
|
-
channel.onmessage = action => {
|
|
45
|
-
if (!(action
|
|
39
|
+
channel.onmessage = (action) => {
|
|
40
|
+
if (!(action == null ? void 0 : action.type)) {
|
|
46
41
|
return;
|
|
47
42
|
}
|
|
48
43
|
tx(() => {
|
|
49
|
-
const {
|
|
50
|
-
|
|
51
|
-
queryHash,
|
|
52
|
-
queryKey,
|
|
53
|
-
state
|
|
54
|
-
} = action;
|
|
55
|
-
if (type === 'updated') {
|
|
44
|
+
const { type, queryHash, queryKey, state } = action;
|
|
45
|
+
if (type === "updated") {
|
|
56
46
|
const query = queryCache.get(queryHash);
|
|
57
47
|
if (query) {
|
|
58
48
|
query.setState(state);
|
|
59
49
|
return;
|
|
60
50
|
}
|
|
61
|
-
queryCache.build(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
51
|
+
queryCache.build(
|
|
52
|
+
queryClient,
|
|
53
|
+
{
|
|
54
|
+
queryKey,
|
|
55
|
+
queryHash
|
|
56
|
+
},
|
|
57
|
+
state
|
|
58
|
+
);
|
|
59
|
+
} else if (type === "removed") {
|
|
66
60
|
const query = queryCache.get(queryHash);
|
|
67
61
|
if (query) {
|
|
68
62
|
queryCache.remove(query);
|
|
@@ -71,6 +65,7 @@ function broadcastQueryClient({
|
|
|
71
65
|
});
|
|
72
66
|
};
|
|
73
67
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
68
|
+
export {
|
|
69
|
+
broadcastQueryClient
|
|
70
|
+
};
|
|
71
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import { BroadcastChannel } from 'broadcast-channel'\nimport type { QueryClient } from '@tanstack/query-core'\n\ninterface BroadcastQueryClientOptions {\n queryClient: QueryClient\n broadcastChannel?: string\n}\n\nexport function broadcastQueryClient({\n queryClient,\n broadcastChannel = 'tanstack-query',\n}: BroadcastQueryClientOptions) {\n let transaction = false\n const tx = (cb: () => void) => {\n transaction = true\n cb()\n transaction = false\n }\n\n const channel = new BroadcastChannel(broadcastChannel, {\n webWorkerSupport: false,\n })\n\n const queryCache = queryClient.getQueryCache()\n\n queryClient.getQueryCache().subscribe((queryEvent) => {\n if (transaction) {\n return\n }\n\n const {\n query: { queryHash, queryKey, state },\n } = queryEvent\n\n if (queryEvent.type === 'updated' && queryEvent.action.type === 'success') {\n channel.postMessage({\n type: 'updated',\n queryHash,\n queryKey,\n state,\n })\n }\n\n if (queryEvent.type === 'removed') {\n channel.postMessage({\n type: 'removed',\n queryHash,\n queryKey,\n })\n }\n })\n\n channel.onmessage = (action) => {\n if (!action?.type) {\n return\n }\n\n tx(() => {\n const { type, queryHash, queryKey, state } = action\n\n if (type === 'updated') {\n const query = queryCache.get(queryHash)\n\n if (query) {\n query.setState(state)\n return\n }\n\n queryCache.build(\n queryClient,\n {\n queryKey,\n queryHash,\n },\n state,\n )\n } else if (type === 'removed') {\n const query = queryCache.get(queryHash)\n\n if (query) {\n queryCache.remove(query)\n }\n }\n })\n }\n}\n"],"mappings":"AAAA,SAAS,wBAAwB;AAQ1B,SAAS,qBAAqB;AAAA,EACnC;AAAA,EACA,mBAAmB;AACrB,GAAgC;AAC9B,MAAI,cAAc;AAClB,QAAM,KAAK,CAAC,OAAmB;AAC7B,kBAAc;AACd,OAAG;AACH,kBAAc;AAAA,EAChB;AAEA,QAAM,UAAU,IAAI,iBAAiB,kBAAkB;AAAA,IACrD,kBAAkB;AAAA,EACpB,CAAC;AAED,QAAM,aAAa,YAAY,cAAc;AAE7C,cAAY,cAAc,EAAE,UAAU,CAAC,eAAe;AACpD,QAAI,aAAa;AACf;AAAA,IACF;AAEA,UAAM;AAAA,MACJ,OAAO,EAAE,WAAW,UAAU,MAAM;AAAA,IACtC,IAAI;AAEJ,QAAI,WAAW,SAAS,aAAa,WAAW,OAAO,SAAS,WAAW;AACzE,cAAQ,YAAY;AAAA,QAClB,MAAM;AAAA,QACN;AAAA,QACA;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH;AAEA,QAAI,WAAW,SAAS,WAAW;AACjC,cAAQ,YAAY;AAAA,QAClB,MAAM;AAAA,QACN;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF,CAAC;AAED,UAAQ,YAAY,CAAC,WAAW;AAC9B,QAAI,EAAC,iCAAQ,OAAM;AACjB;AAAA,IACF;AAEA,OAAG,MAAM;AACP,YAAM,EAAE,MAAM,WAAW,UAAU,MAAM,IAAI;AAE7C,UAAI,SAAS,WAAW;AACtB,cAAM,QAAQ,WAAW,IAAI,SAAS;AAEtC,YAAI,OAAO;AACT,gBAAM,SAAS,KAAK;AACpB;AAAA,QACF;AAEA,mBAAW;AAAA,UACT;AAAA,UACA;AAAA,YACE;AAAA,YACA;AAAA,UACF;AAAA,UACA;AAAA,QACF;AAAA,MACF,WAAW,SAAS,WAAW;AAC7B,cAAM,QAAQ,WAAW,IAAI,SAAS;AAEtC,YAAI,OAAO;AACT,qBAAW,OAAO,KAAK;AAAA,QACzB;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACH;AACF;","names":[]}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var src_exports = {};
|
|
20
|
+
__export(src_exports, {
|
|
21
|
+
broadcastQueryClient: () => broadcastQueryClient
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(src_exports);
|
|
24
|
+
var import_broadcast_channel = require("broadcast-channel");
|
|
25
|
+
function broadcastQueryClient({
|
|
26
|
+
queryClient,
|
|
27
|
+
broadcastChannel = "tanstack-query"
|
|
28
|
+
}) {
|
|
29
|
+
let transaction = false;
|
|
30
|
+
const tx = (cb) => {
|
|
31
|
+
transaction = true;
|
|
32
|
+
cb();
|
|
33
|
+
transaction = false;
|
|
34
|
+
};
|
|
35
|
+
const channel = new import_broadcast_channel.BroadcastChannel(broadcastChannel, {
|
|
36
|
+
webWorkerSupport: false
|
|
37
|
+
});
|
|
38
|
+
const queryCache = queryClient.getQueryCache();
|
|
39
|
+
queryClient.getQueryCache().subscribe((queryEvent) => {
|
|
40
|
+
if (transaction) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const {
|
|
44
|
+
query: { queryHash, queryKey, state }
|
|
45
|
+
} = queryEvent;
|
|
46
|
+
if (queryEvent.type === "updated" && queryEvent.action.type === "success") {
|
|
47
|
+
channel.postMessage({
|
|
48
|
+
type: "updated",
|
|
49
|
+
queryHash,
|
|
50
|
+
queryKey,
|
|
51
|
+
state
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
if (queryEvent.type === "removed") {
|
|
55
|
+
channel.postMessage({
|
|
56
|
+
type: "removed",
|
|
57
|
+
queryHash,
|
|
58
|
+
queryKey
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
channel.onmessage = (action) => {
|
|
63
|
+
if (!action?.type) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
tx(() => {
|
|
67
|
+
const { type, queryHash, queryKey, state } = action;
|
|
68
|
+
if (type === "updated") {
|
|
69
|
+
const query = queryCache.get(queryHash);
|
|
70
|
+
if (query) {
|
|
71
|
+
query.setState(state);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
queryCache.build(
|
|
75
|
+
queryClient,
|
|
76
|
+
{
|
|
77
|
+
queryKey,
|
|
78
|
+
queryHash
|
|
79
|
+
},
|
|
80
|
+
state
|
|
81
|
+
);
|
|
82
|
+
} else if (type === "removed") {
|
|
83
|
+
const query = queryCache.get(queryHash);
|
|
84
|
+
if (query) {
|
|
85
|
+
queryCache.remove(query);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
92
|
+
0 && (module.exports = {
|
|
93
|
+
broadcastQueryClient
|
|
94
|
+
});
|
|
95
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import { BroadcastChannel } from 'broadcast-channel'\nimport type { QueryClient } from '@tanstack/query-core'\n\ninterface BroadcastQueryClientOptions {\n queryClient: QueryClient\n broadcastChannel?: string\n}\n\nexport function broadcastQueryClient({\n queryClient,\n broadcastChannel = 'tanstack-query',\n}: BroadcastQueryClientOptions) {\n let transaction = false\n const tx = (cb: () => void) => {\n transaction = true\n cb()\n transaction = false\n }\n\n const channel = new BroadcastChannel(broadcastChannel, {\n webWorkerSupport: false,\n })\n\n const queryCache = queryClient.getQueryCache()\n\n queryClient.getQueryCache().subscribe((queryEvent) => {\n if (transaction) {\n return\n }\n\n const {\n query: { queryHash, queryKey, state },\n } = queryEvent\n\n if (queryEvent.type === 'updated' && queryEvent.action.type === 'success') {\n channel.postMessage({\n type: 'updated',\n queryHash,\n queryKey,\n state,\n })\n }\n\n if (queryEvent.type === 'removed') {\n channel.postMessage({\n type: 'removed',\n queryHash,\n queryKey,\n })\n }\n })\n\n channel.onmessage = (action) => {\n if (!action?.type) {\n return\n }\n\n tx(() => {\n const { type, queryHash, queryKey, state } = action\n\n if (type === 'updated') {\n const query = queryCache.get(queryHash)\n\n if (query) {\n query.setState(state)\n return\n }\n\n queryCache.build(\n queryClient,\n {\n queryKey,\n queryHash,\n },\n state,\n )\n } else if (type === 'removed') {\n const query = queryCache.get(queryHash)\n\n if (query) {\n queryCache.remove(query)\n }\n }\n })\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA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AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACH;AACF;","names":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { QueryClient } from '@tanstack/query-core';
|
|
2
|
+
|
|
3
|
+
interface BroadcastQueryClientOptions {
|
|
4
|
+
queryClient: QueryClient;
|
|
5
|
+
broadcastChannel?: string;
|
|
6
|
+
}
|
|
7
|
+
declare function broadcastQueryClient({ queryClient, broadcastChannel, }: BroadcastQueryClientOptions): void;
|
|
8
|
+
|
|
9
|
+
export { broadcastQueryClient };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { QueryClient } from '@tanstack/query-core';
|
|
2
|
+
|
|
3
|
+
interface BroadcastQueryClientOptions {
|
|
4
|
+
queryClient: QueryClient;
|
|
5
|
+
broadcastChannel?: string;
|
|
6
|
+
}
|
|
7
|
+
declare function broadcastQueryClient({ queryClient, broadcastChannel, }: BroadcastQueryClientOptions): void;
|
|
8
|
+
|
|
9
|
+
export { broadcastQueryClient };
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { BroadcastChannel } from
|
|
2
|
-
|
|
1
|
+
import { BroadcastChannel } from "broadcast-channel";
|
|
3
2
|
function broadcastQueryClient({
|
|
4
3
|
queryClient,
|
|
5
|
-
broadcastChannel =
|
|
4
|
+
broadcastChannel = "tanstack-query"
|
|
6
5
|
}) {
|
|
7
6
|
let transaction = false;
|
|
8
|
-
const tx = cb => {
|
|
7
|
+
const tx = (cb) => {
|
|
9
8
|
transaction = true;
|
|
10
9
|
cb();
|
|
11
10
|
transaction = false;
|
|
@@ -14,55 +13,50 @@ function broadcastQueryClient({
|
|
|
14
13
|
webWorkerSupport: false
|
|
15
14
|
});
|
|
16
15
|
const queryCache = queryClient.getQueryCache();
|
|
17
|
-
queryClient.getQueryCache().subscribe(queryEvent => {
|
|
16
|
+
queryClient.getQueryCache().subscribe((queryEvent) => {
|
|
18
17
|
if (transaction) {
|
|
19
18
|
return;
|
|
20
19
|
}
|
|
21
20
|
const {
|
|
22
|
-
query: {
|
|
23
|
-
queryHash,
|
|
24
|
-
queryKey,
|
|
25
|
-
state
|
|
26
|
-
}
|
|
21
|
+
query: { queryHash, queryKey, state }
|
|
27
22
|
} = queryEvent;
|
|
28
|
-
if (queryEvent.type ===
|
|
23
|
+
if (queryEvent.type === "updated" && queryEvent.action.type === "success") {
|
|
29
24
|
channel.postMessage({
|
|
30
|
-
type:
|
|
25
|
+
type: "updated",
|
|
31
26
|
queryHash,
|
|
32
27
|
queryKey,
|
|
33
28
|
state
|
|
34
29
|
});
|
|
35
30
|
}
|
|
36
|
-
if (queryEvent.type ===
|
|
31
|
+
if (queryEvent.type === "removed") {
|
|
37
32
|
channel.postMessage({
|
|
38
|
-
type:
|
|
33
|
+
type: "removed",
|
|
39
34
|
queryHash,
|
|
40
35
|
queryKey
|
|
41
36
|
});
|
|
42
37
|
}
|
|
43
38
|
});
|
|
44
|
-
channel.onmessage = action => {
|
|
39
|
+
channel.onmessage = (action) => {
|
|
45
40
|
if (!action?.type) {
|
|
46
41
|
return;
|
|
47
42
|
}
|
|
48
43
|
tx(() => {
|
|
49
|
-
const {
|
|
50
|
-
|
|
51
|
-
queryHash,
|
|
52
|
-
queryKey,
|
|
53
|
-
state
|
|
54
|
-
} = action;
|
|
55
|
-
if (type === 'updated') {
|
|
44
|
+
const { type, queryHash, queryKey, state } = action;
|
|
45
|
+
if (type === "updated") {
|
|
56
46
|
const query = queryCache.get(queryHash);
|
|
57
47
|
if (query) {
|
|
58
48
|
query.setState(state);
|
|
59
49
|
return;
|
|
60
50
|
}
|
|
61
|
-
queryCache.build(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
51
|
+
queryCache.build(
|
|
52
|
+
queryClient,
|
|
53
|
+
{
|
|
54
|
+
queryKey,
|
|
55
|
+
queryHash
|
|
56
|
+
},
|
|
57
|
+
state
|
|
58
|
+
);
|
|
59
|
+
} else if (type === "removed") {
|
|
66
60
|
const query = queryCache.get(queryHash);
|
|
67
61
|
if (query) {
|
|
68
62
|
queryCache.remove(query);
|
|
@@ -71,6 +65,7 @@ function broadcastQueryClient({
|
|
|
71
65
|
});
|
|
72
66
|
};
|
|
73
67
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
68
|
+
export {
|
|
69
|
+
broadcastQueryClient
|
|
70
|
+
};
|
|
71
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import { BroadcastChannel } from 'broadcast-channel'\nimport type { QueryClient } from '@tanstack/query-core'\n\ninterface BroadcastQueryClientOptions {\n queryClient: QueryClient\n broadcastChannel?: string\n}\n\nexport function broadcastQueryClient({\n queryClient,\n broadcastChannel = 'tanstack-query',\n}: BroadcastQueryClientOptions) {\n let transaction = false\n const tx = (cb: () => void) => {\n transaction = true\n cb()\n transaction = false\n }\n\n const channel = new BroadcastChannel(broadcastChannel, {\n webWorkerSupport: false,\n })\n\n const queryCache = queryClient.getQueryCache()\n\n queryClient.getQueryCache().subscribe((queryEvent) => {\n if (transaction) {\n return\n }\n\n const {\n query: { queryHash, queryKey, state },\n } = queryEvent\n\n if (queryEvent.type === 'updated' && queryEvent.action.type === 'success') {\n channel.postMessage({\n type: 'updated',\n queryHash,\n queryKey,\n state,\n })\n }\n\n if (queryEvent.type === 'removed') {\n channel.postMessage({\n type: 'removed',\n queryHash,\n queryKey,\n })\n }\n })\n\n channel.onmessage = (action) => {\n if (!action?.type) {\n return\n }\n\n tx(() => {\n const { type, queryHash, queryKey, state } = action\n\n if (type === 'updated') {\n const query = queryCache.get(queryHash)\n\n if (query) {\n query.setState(state)\n return\n }\n\n queryCache.build(\n queryClient,\n {\n queryKey,\n queryHash,\n },\n state,\n )\n } else if (type === 'removed') {\n const query = queryCache.get(queryHash)\n\n if (query) {\n queryCache.remove(query)\n }\n }\n })\n }\n}\n"],"mappings":"AAAA,SAAS,wBAAwB;AAQ1B,SAAS,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package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/query-broadcast-client-experimental",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.87",
|
|
4
4
|
"description": "An experimental plugin to for broadcasting the state of your queryClient between browser tabs/windows",
|
|
5
5
|
"author": "tannerlinsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -11,34 +11,36 @@
|
|
|
11
11
|
"url": "https://github.com/sponsors/tannerlinsley"
|
|
12
12
|
},
|
|
13
13
|
"type": "module",
|
|
14
|
-
"types": "build/
|
|
15
|
-
"main": "build/
|
|
16
|
-
"module": "build/
|
|
14
|
+
"types": "build/legacy/index.d.ts",
|
|
15
|
+
"main": "build/legacy/index.cjs",
|
|
16
|
+
"module": "build/legacy/index.js",
|
|
17
17
|
"exports": {
|
|
18
18
|
".": {
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
"import": {
|
|
20
|
+
"types": "./build/modern/index.d.ts",
|
|
21
|
+
"default": "./build/modern/index.js"
|
|
22
|
+
},
|
|
23
|
+
"require": {
|
|
24
|
+
"types": "./build/modern/index.d.cts",
|
|
25
|
+
"default": "./build/modern/index.cjs"
|
|
26
|
+
}
|
|
23
27
|
},
|
|
24
28
|
"./package.json": "./package.json"
|
|
25
29
|
},
|
|
26
30
|
"sideEffects": false,
|
|
27
31
|
"files": [
|
|
28
|
-
"build
|
|
32
|
+
"build",
|
|
29
33
|
"src"
|
|
30
34
|
],
|
|
31
35
|
"dependencies": {
|
|
32
36
|
"broadcast-channel": "^5.1.0",
|
|
33
|
-
"@tanstack/query-core": "5.0.0-alpha.
|
|
37
|
+
"@tanstack/query-core": "5.0.0-alpha.87"
|
|
34
38
|
},
|
|
35
39
|
"scripts": {
|
|
36
40
|
"clean": "rimraf ./build && rimraf ./coverage",
|
|
37
41
|
"test:eslint": "eslint --ext .ts,.tsx ./src",
|
|
38
42
|
"test:types": "tsc --noEmit",
|
|
39
|
-
"test:build": "publint --strict",
|
|
40
|
-
"build": "
|
|
41
|
-
"build:rollup": "rollup --config rollup.config.js",
|
|
42
|
-
"build:types": "tsc --emitDeclarationOnly"
|
|
43
|
+
"test:build": "publint --strict && attw --pack",
|
|
44
|
+
"build": "tsup"
|
|
43
45
|
}
|
|
44
46
|
}
|
package/build/lib/index.cjs
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var broadcastChannel = require('broadcast-channel');
|
|
4
|
-
|
|
5
|
-
function broadcastQueryClient({
|
|
6
|
-
queryClient,
|
|
7
|
-
broadcastChannel: broadcastChannel$1 = 'tanstack-query'
|
|
8
|
-
}) {
|
|
9
|
-
let transaction = false;
|
|
10
|
-
const tx = cb => {
|
|
11
|
-
transaction = true;
|
|
12
|
-
cb();
|
|
13
|
-
transaction = false;
|
|
14
|
-
};
|
|
15
|
-
const channel = new broadcastChannel.BroadcastChannel(broadcastChannel$1, {
|
|
16
|
-
webWorkerSupport: false
|
|
17
|
-
});
|
|
18
|
-
const queryCache = queryClient.getQueryCache();
|
|
19
|
-
queryClient.getQueryCache().subscribe(queryEvent => {
|
|
20
|
-
if (transaction) {
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
const {
|
|
24
|
-
query: {
|
|
25
|
-
queryHash,
|
|
26
|
-
queryKey,
|
|
27
|
-
state
|
|
28
|
-
}
|
|
29
|
-
} = queryEvent;
|
|
30
|
-
if (queryEvent.type === 'updated' && queryEvent.action.type === 'success') {
|
|
31
|
-
channel.postMessage({
|
|
32
|
-
type: 'updated',
|
|
33
|
-
queryHash,
|
|
34
|
-
queryKey,
|
|
35
|
-
state
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
if (queryEvent.type === 'removed') {
|
|
39
|
-
channel.postMessage({
|
|
40
|
-
type: 'removed',
|
|
41
|
-
queryHash,
|
|
42
|
-
queryKey
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
channel.onmessage = action => {
|
|
47
|
-
if (!action?.type) {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
tx(() => {
|
|
51
|
-
const {
|
|
52
|
-
type,
|
|
53
|
-
queryHash,
|
|
54
|
-
queryKey,
|
|
55
|
-
state
|
|
56
|
-
} = action;
|
|
57
|
-
if (type === 'updated') {
|
|
58
|
-
const query = queryCache.get(queryHash);
|
|
59
|
-
if (query) {
|
|
60
|
-
query.setState(state);
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
queryCache.build(queryClient, {
|
|
64
|
-
queryKey,
|
|
65
|
-
queryHash
|
|
66
|
-
}, state);
|
|
67
|
-
} else if (type === 'removed') {
|
|
68
|
-
const query = queryCache.get(queryHash);
|
|
69
|
-
if (query) {
|
|
70
|
-
queryCache.remove(query);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
exports.broadcastQueryClient = broadcastQueryClient;
|
|
78
|
-
//# sourceMappingURL=index.cjs.map
|
package/build/lib/index.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/index.ts"],"sourcesContent":["import { BroadcastChannel } from 'broadcast-channel'\nimport type { QueryClient } from '@tanstack/query-core'\n\ninterface BroadcastQueryClientOptions {\n queryClient: QueryClient\n broadcastChannel?: string\n}\n\nexport function broadcastQueryClient({\n queryClient,\n broadcastChannel = 'tanstack-query',\n}: BroadcastQueryClientOptions) {\n let transaction = false\n const tx = (cb: () => void) => {\n transaction = true\n cb()\n transaction = false\n }\n\n const channel = new BroadcastChannel(broadcastChannel, {\n webWorkerSupport: false,\n })\n\n const queryCache = queryClient.getQueryCache()\n\n queryClient.getQueryCache().subscribe((queryEvent) => {\n if (transaction) {\n return\n }\n\n const {\n query: { queryHash, queryKey, state },\n } = queryEvent\n\n if (queryEvent.type === 'updated' && queryEvent.action.type === 'success') {\n channel.postMessage({\n type: 'updated',\n queryHash,\n queryKey,\n state,\n })\n }\n\n if (queryEvent.type === 'removed') {\n channel.postMessage({\n type: 'removed',\n queryHash,\n queryKey,\n })\n }\n })\n\n channel.onmessage = (action) => {\n if (!action?.type) {\n return\n }\n\n tx(() => {\n const { type, queryHash, queryKey, state } = action\n\n if (type === 'updated') {\n const query = queryCache.get(queryHash)\n\n if (query) {\n query.setState(state)\n return\n }\n\n queryCache.build(\n queryClient,\n {\n queryKey,\n queryHash,\n },\n state,\n )\n } else if (type === 'removed') {\n const query = queryCache.get(queryHash)\n\n if (query) {\n queryCache.remove(query)\n }\n }\n })\n }\n}\n"],"names":["broadcastQueryClient","queryClient","broadcastChannel","transaction","tx","cb","channel","BroadcastChannel","webWorkerSupport","queryCache","getQueryCache","subscribe","queryEvent","query","queryHash","queryKey","state","type","action","postMessage","onmessage","get","setState","build","remove"],"mappings":";;;;AAQO,SAASA,oBAAoBA,CAAC;EACnCC,WAAW;AACXC,oBAAAA,kBAAgB,GAAG,gBAAA;AACQ,CAAC,EAAE;EAC9B,IAAIC,WAAW,GAAG,KAAK,CAAA;EACvB,MAAMC,EAAE,GAAIC,EAAc,IAAK;AAC7BF,IAAAA,WAAW,GAAG,IAAI,CAAA;AAClBE,IAAAA,EAAE,EAAE,CAAA;AACJF,IAAAA,WAAW,GAAG,KAAK,CAAA;GACpB,CAAA;AAED,EAAA,MAAMG,OAAO,GAAG,IAAIC,iCAAgB,CAACL,kBAAgB,EAAE;AACrDM,IAAAA,gBAAgB,EAAE,KAAA;AACpB,GAAC,CAAC,CAAA;AAEF,EAAA,MAAMC,UAAU,GAAGR,WAAW,CAACS,aAAa,EAAE,CAAA;EAE9CT,WAAW,CAACS,aAAa,EAAE,CAACC,SAAS,CAAEC,UAAU,IAAK;AACpD,IAAA,IAAIT,WAAW,EAAE;AACf,MAAA,OAAA;AACF,KAAA;IAEA,MAAM;AACJU,MAAAA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QAAA,MAAMJ,KAAK,GAAGJ,UAAU,CAACY,GAAG,CAACP,SAAS,CAAC,CAAA;AAEvC,QAAA,IAAID,KAAK,EAAE;AACTJ,UAAAA,UAAU,CAACe,MAAM,CAACX,KAAK,CAAC,CAAA;AAC1B,SAAA;AACF,OAAA;AACF,KAAC,CAAC,CAAA;GACH,CAAA;AACH;;;;"}
|
package/build/lib/index.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { QueryClient } from '@tanstack/query-core';
|
|
2
|
-
interface BroadcastQueryClientOptions {
|
|
3
|
-
queryClient: QueryClient;
|
|
4
|
-
broadcastChannel?: string;
|
|
5
|
-
}
|
|
6
|
-
export declare function broadcastQueryClient({ queryClient, broadcastChannel, }: BroadcastQueryClientOptions): void;
|
|
7
|
-
export {};
|
|
8
|
-
//# sourceMappingURL=index.d.ts.map
|
package/build/lib/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAEvD,UAAU,2BAA2B;IACnC,WAAW,EAAE,WAAW,CAAA;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAC1B;AAED,wBAAgB,oBAAoB,CAAC,EACnC,WAAW,EACX,gBAAmC,GACpC,EAAE,2BAA2B,QA0E7B"}
|
package/build/lib/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":["import { BroadcastChannel } from 'broadcast-channel'\nimport type { QueryClient } from '@tanstack/query-core'\n\ninterface BroadcastQueryClientOptions {\n queryClient: QueryClient\n broadcastChannel?: string\n}\n\nexport function broadcastQueryClient({\n queryClient,\n broadcastChannel = 'tanstack-query',\n}: BroadcastQueryClientOptions) {\n let transaction = false\n const tx = (cb: () => void) => {\n transaction = true\n cb()\n transaction = false\n }\n\n const channel = new BroadcastChannel(broadcastChannel, {\n webWorkerSupport: false,\n })\n\n const queryCache = queryClient.getQueryCache()\n\n queryClient.getQueryCache().subscribe((queryEvent) => {\n if (transaction) {\n return\n }\n\n const {\n query: { queryHash, queryKey, state },\n } = queryEvent\n\n if (queryEvent.type === 'updated' && queryEvent.action.type === 'success') {\n channel.postMessage({\n type: 'updated',\n queryHash,\n queryKey,\n state,\n })\n }\n\n if (queryEvent.type === 'removed') {\n channel.postMessage({\n type: 'removed',\n queryHash,\n queryKey,\n })\n }\n })\n\n channel.onmessage = (action) => {\n if (!action?.type) {\n return\n }\n\n tx(() => {\n const { type, queryHash, queryKey, state } = action\n\n if (type === 'updated') {\n const query = queryCache.get(queryHash)\n\n if (query) {\n query.setState(state)\n return\n }\n\n queryCache.build(\n queryClient,\n {\n queryKey,\n queryHash,\n },\n state,\n )\n } else if (type === 'removed') {\n const query = queryCache.get(queryHash)\n\n if (query) {\n queryCache.remove(query)\n }\n }\n })\n }\n}\n"],"names":["broadcastQueryClient","queryClient","broadcastChannel","transaction","tx","cb","channel","BroadcastChannel","webWorkerSupport","queryCache","getQueryCache","subscribe","queryEvent","query","queryHash","queryKey","state","type","action","postMessage","onmessage","get","setState","build","remove"],"mappings":";;AAQO,SAASA,oBAAoBA,CAAC;EACnCC,WAAW;AACXC,EAAAA,gBAAgB,GAAG,gBAAA;AACQ,CAAC,EAAE;EAC9B,IAAIC,WAAW,GAAG,KAAK,CAAA;EACvB,MAAMC,EAAE,GAAIC,EAAc,IAAK;AAC7BF,IAAAA,WAAW,GAAG,IAAI,CAAA;AAClBE,IAAAA,EAAE,EAAE,CAAA;AACJF,IAAAA,WAAW,GAAG,KAAK,CAAA;GACpB,CAAA;AAED,EAAA,MAAMG,OAAO,GAAG,IAAIC,gBAAgB,CAACL,gBAAgB,EAAE;AACrDM,IAAAA,gBAAgB,EAAE,KAAA;AACpB,GAAC,CAAC,CAAA;AAEF,EAAA,MAAMC,UAAU,GAAG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;AACF,SAAA;AAEAP,QAAAA,UAAU,CAACc,KAAK,CACdtB,WAAW,EACX;UACEc,QAAQ;AACRD,UAAAA,SAAAA;SACD,EACDE,KACF,CAAC,CAAA;AACH,OAAC,MAAM,IAAIC,IAAI,KAAK,SAAS,EAAE;AAC7B,QAAA,MAAMJ,KAAK,GAAGJ,UAAU,CAACY,GAAG,CAACP,SAAS,CAAC,CAAA;AAEvC,QAAA,IAAID,KAAK,EAAE;AACTJ,UAAAA,UAAU,CAACe,MAAM,CAACX,KAAK,CAAC,CAAA;AAC1B,SAAA;AACF,OAAA;AACF,KAAC,CAAC,CAAA;GACH,CAAA;AACH;;;;"}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var broadcastChannel = require('broadcast-channel');
|
|
4
|
-
|
|
5
|
-
function broadcastQueryClient({
|
|
6
|
-
queryClient,
|
|
7
|
-
broadcastChannel: broadcastChannel$1 = 'tanstack-query'
|
|
8
|
-
}) {
|
|
9
|
-
let transaction = false;
|
|
10
|
-
const tx = cb => {
|
|
11
|
-
transaction = true;
|
|
12
|
-
cb();
|
|
13
|
-
transaction = false;
|
|
14
|
-
};
|
|
15
|
-
const channel = new broadcastChannel.BroadcastChannel(broadcastChannel$1, {
|
|
16
|
-
webWorkerSupport: false
|
|
17
|
-
});
|
|
18
|
-
const queryCache = queryClient.getQueryCache();
|
|
19
|
-
queryClient.getQueryCache().subscribe(queryEvent => {
|
|
20
|
-
if (transaction) {
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
const {
|
|
24
|
-
query: {
|
|
25
|
-
queryHash,
|
|
26
|
-
queryKey,
|
|
27
|
-
state
|
|
28
|
-
}
|
|
29
|
-
} = queryEvent;
|
|
30
|
-
if (queryEvent.type === 'updated' && queryEvent.action.type === 'success') {
|
|
31
|
-
channel.postMessage({
|
|
32
|
-
type: 'updated',
|
|
33
|
-
queryHash,
|
|
34
|
-
queryKey,
|
|
35
|
-
state
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
if (queryEvent.type === 'removed') {
|
|
39
|
-
channel.postMessage({
|
|
40
|
-
type: 'removed',
|
|
41
|
-
queryHash,
|
|
42
|
-
queryKey
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
channel.onmessage = action => {
|
|
47
|
-
if (!(action != null && action.type)) {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
tx(() => {
|
|
51
|
-
const {
|
|
52
|
-
type,
|
|
53
|
-
queryHash,
|
|
54
|
-
queryKey,
|
|
55
|
-
state
|
|
56
|
-
} = action;
|
|
57
|
-
if (type === 'updated') {
|
|
58
|
-
const query = queryCache.get(queryHash);
|
|
59
|
-
if (query) {
|
|
60
|
-
query.setState(state);
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
queryCache.build(queryClient, {
|
|
64
|
-
queryKey,
|
|
65
|
-
queryHash
|
|
66
|
-
}, state);
|
|
67
|
-
} else if (type === 'removed') {
|
|
68
|
-
const query = queryCache.get(queryHash);
|
|
69
|
-
if (query) {
|
|
70
|
-
queryCache.remove(query);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
exports.broadcastQueryClient = broadcastQueryClient;
|
|
78
|
-
//# sourceMappingURL=index.legacy.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.legacy.cjs","sources":["../../src/index.ts"],"sourcesContent":["import { BroadcastChannel } from 'broadcast-channel'\nimport type { QueryClient } from '@tanstack/query-core'\n\ninterface BroadcastQueryClientOptions {\n queryClient: QueryClient\n broadcastChannel?: string\n}\n\nexport function broadcastQueryClient({\n queryClient,\n broadcastChannel = 'tanstack-query',\n}: BroadcastQueryClientOptions) {\n let transaction = false\n const tx = (cb: () => void) => {\n transaction = true\n cb()\n transaction = false\n }\n\n const channel = new BroadcastChannel(broadcastChannel, {\n webWorkerSupport: false,\n })\n\n const queryCache = queryClient.getQueryCache()\n\n queryClient.getQueryCache().subscribe((queryEvent) => {\n if (transaction) {\n return\n }\n\n const {\n query: { queryHash, queryKey, state },\n } = queryEvent\n\n if (queryEvent.type === 'updated' && queryEvent.action.type === 'success') {\n channel.postMessage({\n type: 'updated',\n queryHash,\n queryKey,\n state,\n })\n }\n\n if (queryEvent.type === 'removed') {\n channel.postMessage({\n type: 'removed',\n queryHash,\n queryKey,\n })\n }\n })\n\n channel.onmessage = (action) => {\n if (!action?.type) {\n return\n }\n\n tx(() => {\n const { type, queryHash, queryKey, state } = action\n\n if (type === 'updated') {\n const query = queryCache.get(queryHash)\n\n if (query) {\n query.setState(state)\n return\n }\n\n queryCache.build(\n queryClient,\n {\n queryKey,\n queryHash,\n },\n state,\n )\n } else if (type === 'removed') {\n const query = queryCache.get(queryHash)\n\n if (query) {\n queryCache.remove(query)\n }\n }\n })\n }\n}\n"],"names":["broadcastQueryClient","queryClient","broadcastChannel","transaction","tx","cb","channel","BroadcastChannel","webWorkerSupport","queryCache","getQueryCache","subscribe","queryEvent","query","queryHash","queryKey","state","type","action","postMessage","onmessage","get","setState","build","remove"],"mappings":";;;;AAQO,SAASA,oBAAoBA,CAAC;EACnCC,WAAW;AACXC,oBAAAA,kBAAgB,GAAG,gBAAA;AACQ,CAAC,EAAE;EAC9B,IAAIC,WAAW,GAAG,KAAK,CAAA;EACvB,MAAMC,EAAE,GAAIC,EAAc,IAAK;AAC7BF,IAAAA,WAAW,GAAG,IAAI,CAAA;AAClBE,IAAAA,EAAE,EAAE,CAAA;AACJF,IAAAA,WAAW,GAAG,KAAK,CAAA;GACpB,CAAA;AAED,EAAA,MAAMG,OAAO,GAAG,IAAIC,iCAAgB,CAACL,kBAAgB,EAAE;AACrDM,IAAAA,gBAAgB,EAAE,KAAA;AACpB,GAAC,CAAC,CAAA;AAEF,EAAA,MAAMC,UAAU,GAAGR,WAAW,CAACS,aAAa,EAAE,CAAA;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ACF,SAAA;AAEAP,QAAAA,UAAU,CAACc,KAAK,CACdtB,WAAW,EACX;UACEc,QAAQ;AACRD,UAAAA,SAAAA;SACD,EACDE,KACF,CAAC,CAAA;AACH,OAAC,MAAM,IAAIC,IAAI,KAAK,SAAS,EAAE;AAC7B,QAAA,MAAMJ,KAAK,GAAGJ,UAAU,CAACY,GAAG,CAACP,SAAS,CAAC,CAAA;AAEvC,QAAA,IAAID,KAAK,EAAE;AACTJ,UAAAA,UAAU,CAACe,MAAM,CAACX,KAAK,CAAC,CAAA;AAC1B,SAAA;AACF,OAAA;AACF,KAAC,CAAC,CAAA;GACH,CAAA;AACH;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.legacy.js","sources":["../../src/index.ts"],"sourcesContent":["import { BroadcastChannel } from 'broadcast-channel'\nimport type { QueryClient } from '@tanstack/query-core'\n\ninterface BroadcastQueryClientOptions {\n queryClient: QueryClient\n broadcastChannel?: string\n}\n\nexport function broadcastQueryClient({\n queryClient,\n broadcastChannel = 'tanstack-query',\n}: BroadcastQueryClientOptions) {\n let transaction = false\n const tx = (cb: () => void) => {\n transaction = true\n cb()\n transaction = false\n }\n\n const channel = new BroadcastChannel(broadcastChannel, {\n webWorkerSupport: false,\n })\n\n const queryCache = queryClient.getQueryCache()\n\n queryClient.getQueryCache().subscribe((queryEvent) => {\n if (transaction) {\n return\n }\n\n const {\n query: { queryHash, queryKey, state },\n } = queryEvent\n\n if (queryEvent.type === 'updated' && queryEvent.action.type === 'success') {\n channel.postMessage({\n type: 'updated',\n queryHash,\n queryKey,\n state,\n })\n }\n\n if (queryEvent.type === 'removed') {\n channel.postMessage({\n type: 'removed',\n queryHash,\n queryKey,\n })\n }\n })\n\n channel.onmessage = (action) => {\n if (!action?.type) {\n return\n }\n\n tx(() => {\n const { type, queryHash, queryKey, state } = action\n\n if (type === 'updated') {\n const query = queryCache.get(queryHash)\n\n if (query) {\n query.setState(state)\n return\n }\n\n queryCache.build(\n queryClient,\n {\n queryKey,\n queryHash,\n },\n state,\n )\n } else if (type === 'removed') {\n const query = queryCache.get(queryHash)\n\n if (query) {\n queryCache.remove(query)\n }\n }\n })\n }\n}\n"],"names":["broadcastQueryClient","queryClient","broadcastChannel","transaction","tx","cb","channel","BroadcastChannel","webWorkerSupport","queryCache","getQueryCache","subscribe","queryEvent","query","queryHash","queryKey","state","type","action","postMessage","onmessage","get","setState","build","remove"],"mappings":";;AAQO,SAASA,oBAAoBA,CAAC;EACnCC,WAAW;AACXC,EAAAA,gBAAgB,GAAG,gBAAA;AACQ,CAAC,EAAE;EAC9B,IAAIC,WAAW,GAAG,KAAK,CAAA;EACvB,MAAMC,EAAE,GAAIC,EAAc,IAAK;AAC7BF,IAAAA,WAAW,GAAG,IAAI,CAAA;AAClBE,IAAAA,EAAE,EAAE,CAAA;AACJF,IAAAA,WAAW,GAAG,KAAK,CAAA;GACpB,CAAA;AAED,EAAA,MAAMG,OAAO,GAAG,IAAIC,gBAAgB,CAACL,gBAAgB,EAAE;AACrDM,IAAAA,gBAAgB,EAAE,KAAA;AACpB,GAAC,CAAC,CAAA;AAEF,EAAA,MAAMC,UAAU,GAAGR,WAAW,CAACS,aAAa,EAAE,CAAA;EAE9CT,WAAW,CAACS,aAAa,EAAE,CAACC,SAAS,CAAEC,UAAU,IAAK;AACpD,IAAA,IAAIT,WAAW,EAAE;AACf,MAAA,OAAA;AACF,KAAA;IAEA,MAAM;AACJU,MAAAA,KAAK,EAAE;QAAEC,SAAS;QAAEC,QAAQ;AAAEC,QAAAA,KAAAA;AAAM,OAAA;AACtC,KAAC,GAAGJ,UAAU,CAAA;AAEd,IAAA,IAAIA,UAAU,CAACK,IAAI,KAAK,SAAS,IAAIL,UAAU,CAACM,MAAM,CAACD,IAAI,KAAK,SAAS,EAAE;MACzEX,OAAO,CAACa,WAAW,CAAC;AAClBF,QAAAA,IAAI,EAAE,SAAS;QACfH,SAAS;QACTC,QAAQ;AACRC,QAAAA,KAAAA;AACF,OAA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