@mittwald/react-ghostmaker 1.4.9 → 1.5.0
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/esm/invalidate.js
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
+
import { withEachGhost } from "./withEachGhost.js";
|
|
1
2
|
export async function invalidateGhosts(queryClient, queryKey) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
await queryClient.invalidateQueries({
|
|
6
|
-
queryKey: partialKey,
|
|
7
|
-
exact,
|
|
8
|
-
});
|
|
9
|
-
}
|
|
3
|
+
await withEachGhost(queryKey, async (filter) => {
|
|
4
|
+
await queryClient.invalidateQueries(filter);
|
|
5
|
+
});
|
|
10
6
|
}
|
package/dist/esm/makeGhost.js
CHANGED
|
@@ -5,6 +5,7 @@ import { RenderComponent } from "./RenderComponent.js";
|
|
|
5
5
|
import { resolveGhostChain } from "./resolveGhostChain.js";
|
|
6
6
|
import { invalidateGhosts } from "./invalidate.js";
|
|
7
7
|
import { queries } from "./queries.js";
|
|
8
|
+
import { resetGhosts } from "./reset.js";
|
|
8
9
|
function buildGhostDeep(target, ghostChain) {
|
|
9
10
|
const proxyTarget = (() => {
|
|
10
11
|
// Dummy function to allow ghosting function calls
|
|
@@ -28,6 +29,7 @@ function buildGhostDeep(target, ghostChain) {
|
|
|
28
29
|
return ghost;
|
|
29
30
|
},
|
|
30
31
|
invalidate: (queryClient) => invalidateGhosts(queryClient, queries.ghostChain(target, ghostChain)),
|
|
32
|
+
reset: (queryClient) => resetGhosts(queryClient, queries.ghostChain(target, ghostChain)),
|
|
31
33
|
};
|
|
32
34
|
const ghost = new Proxy(proxyTarget, {
|
|
33
35
|
get: ($, prop) => {
|
package/dist/types/types.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export interface ReactGhostMethods<T> extends Promise<T> {
|
|
|
16
16
|
render: (transform?: (item: T) => ReactNode) => ReactNode;
|
|
17
17
|
transform: <U, U2 = U>(fn: (item: T extends ReactGhost<infer T2> ? T2 : T) => U2, dependencies?: DependencyList) => ReactGhost<U2>;
|
|
18
18
|
invalidate: (queryClient: QueryClient) => Promise<void>;
|
|
19
|
+
reset: (queryClient: QueryClient) => Promise<void>;
|
|
19
20
|
}
|
|
20
21
|
export declare const transformFnProp: "___transformFn";
|
|
21
22
|
export declare const isGhostMarker: "___ghostMarker";
|