@spoosh/plugin-initial-data 0.1.1 → 0.1.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/README.md CHANGED
@@ -13,16 +13,18 @@ npm install @spoosh/plugin-initial-data
13
13
  ## Usage
14
14
 
15
15
  ```typescript
16
+ import { Spoosh } from "@spoosh/core";
16
17
  import { initialDataPlugin } from "@spoosh/plugin-initial-data";
17
18
 
18
- const plugins = [initialDataPlugin()] as const;
19
+ const client = new Spoosh<ApiSchema, Error>("/api")
20
+ .use([
21
+ initialDataPlugin(),
22
+ ]);
19
23
 
20
- // Show prefetched data immediately, then refetch in background
21
24
  const { data, isInitialData } = useRead((api) => api.posts.$get(), {
22
25
  initialData: prefetchedPosts,
23
26
  });
24
27
 
25
- // Show initial data without background refetch
26
28
  const { data } = useRead((api) => api.posts.$get(), {
27
29
  initialData: prefetchedPosts,
28
30
  refetchOnInitialData: false,
package/dist/index.d.mts CHANGED
@@ -31,10 +31,13 @@ declare module "@spoosh/core" {
31
31
  *
32
32
  * @example
33
33
  * ```ts
34
- * const plugins = [
35
- * initialDataPlugin(),
36
- * cachePlugin({ staleTime: 5000 }),
37
- * ];
34
+ * import { Spoosh } from "@spoosh/core";
35
+ *
36
+ * const client = new Spoosh<ApiSchema, Error>("/api")
37
+ * .use([
38
+ * initialDataPlugin(),
39
+ * cachePlugin({ staleTime: 5000 }),
40
+ * ]);
38
41
  *
39
42
  * // Basic usage - shows initialData, refetches in background
40
43
  * const { data, isInitialData } = useRead(
package/dist/index.d.ts CHANGED
@@ -31,10 +31,13 @@ declare module "@spoosh/core" {
31
31
  *
32
32
  * @example
33
33
  * ```ts
34
- * const plugins = [
35
- * initialDataPlugin(),
36
- * cachePlugin({ staleTime: 5000 }),
37
- * ];
34
+ * import { Spoosh } from "@spoosh/core";
35
+ *
36
+ * const client = new Spoosh<ApiSchema, Error>("/api")
37
+ * .use([
38
+ * initialDataPlugin(),
39
+ * cachePlugin({ staleTime: 5000 }),
40
+ * ]);
38
41
  *
39
42
  * // Basic usage - shows initialData, refetches in background
40
43
  * const { data, isInitialData } = useRead(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spoosh/plugin-initial-data",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Initial data plugin for Spoosh - show data immediately before fetch completes",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -33,11 +33,11 @@
33
33
  }
34
34
  },
35
35
  "peerDependencies": {
36
- "@spoosh/core": ">=0.2.0"
36
+ "@spoosh/core": ">=0.3.0"
37
37
  },
38
38
  "devDependencies": {
39
- "@spoosh/core": "0.2.0",
40
- "@spoosh/test-utils": "0.1.1"
39
+ "@spoosh/core": "0.3.0",
40
+ "@spoosh/test-utils": "0.1.3"
41
41
  },
42
42
  "scripts": {
43
43
  "dev": "tsup --watch",