autosuspense 0.1.9 → 0.1.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autosuspense",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "Automatic suspense wiring block for React.",
5
5
  "license": "ISC",
6
6
  "type": "commonjs",
@@ -1,10 +1,10 @@
1
+ import * as React from "react";
1
2
  import { Block } from "./prebuilt/Block";
2
3
  import { Card } from "./prebuilt/Card";
3
4
  import { List } from "./prebuilt/List";
4
- import { PrefabFactory } from "../../types/PrefabFactory";
5
5
 
6
- export const defaultPrefab: Record<string, PrefabFactory> = {
7
- block: ({ children }) => <Block>{children}</Block>,
8
- card: ({ children }) => <Card>{children}</Card>,
9
- list: ({ children }) => <List>{children}</List>,
6
+ export const defaultPrefab: Record<string, React.ReactElement> = {
7
+ block: <Block />,
8
+ card: <Card />,
9
+ list: <List />,
10
10
  };
@@ -13,7 +13,7 @@ export const AutoSuspense = ({
13
13
  prefab = defaultPrefab,
14
14
  }: {
15
15
  children: React.ReactNode;
16
- prefab?: Record<string, PrefabFactory>;
16
+ prefab?: Record<string, React.ReactElement>;
17
17
  }) => {
18
18
  const registryRef = React.useRef<FallbackRegistry>({
19
19
  nodes: new Map(),
@@ -32,9 +32,11 @@ export const AutoSuspense = ({
32
32
 
33
33
  return (
34
34
  <FallbackContext.Provider value={registryRef.current}>
35
+ <div>
35
36
  <React.Suspense fallback={fallback}>
36
- <div>{children}</div>
37
+ {children}
37
38
  </React.Suspense>
39
+ </div>
38
40
  </FallbackContext.Provider>
39
41
  );
40
42
  };