@faasjs/ant-design 0.0.2-beta.349 → 0.0.2-beta.350

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/index.js CHANGED
@@ -100,13 +100,18 @@ function FaasDataWrapper({
100
100
  (0, import_react2.useEffect)(() => {
101
101
  if (!faasData)
102
102
  return;
103
- (0, import_react3.getClient)().faas(faasData.action, faasData.params).then((res) => setData(res.data));
104
- }, [JSON.stringify(faasData)]);
103
+ (0, import_react3.getClient)().faas(faasData.action, faasData.params).then((res) => {
104
+ if (faasData.setData)
105
+ faasData.setData(res.data);
106
+ else
107
+ setData(res.data);
108
+ });
109
+ }, [JSON.stringify([faasData == null ? void 0 : faasData.action, faasData == null ? void 0 : faasData.params])]);
105
110
  if (dataSource)
106
111
  return render({ data: dataSource });
107
- if (!data)
112
+ if (!data && !faasData.data)
108
113
  return fallback || null;
109
- return render({ data });
114
+ return render({ data: faasData.data || data });
110
115
  }
111
116
 
112
117
  // src/Description.tsx
package/dist/index.mjs CHANGED
@@ -54,7 +54,10 @@ import {
54
54
  } from "react";
55
55
 
56
56
  // src/FaasWrapper.tsx
57
- import { useEffect, useState } from "react";
57
+ import {
58
+ useEffect,
59
+ useState
60
+ } from "react";
58
61
  import { getClient } from "@faasjs/react";
59
62
  function FaasDataWrapper({
60
63
  dataSource,
@@ -66,13 +69,18 @@ function FaasDataWrapper({
66
69
  useEffect(() => {
67
70
  if (!faasData)
68
71
  return;
69
- getClient().faas(faasData.action, faasData.params).then((res) => setData(res.data));
70
- }, [JSON.stringify(faasData)]);
72
+ getClient().faas(faasData.action, faasData.params).then((res) => {
73
+ if (faasData.setData)
74
+ faasData.setData(res.data);
75
+ else
76
+ setData(res.data);
77
+ });
78
+ }, [JSON.stringify([faasData == null ? void 0 : faasData.action, faasData == null ? void 0 : faasData.params])]);
71
79
  if (dataSource)
72
80
  return render({ data: dataSource });
73
- if (!data)
81
+ if (!data && !faasData.data)
74
82
  return fallback || null;
75
- return render({ data });
83
+ return render({ data: faasData.data || data });
76
84
  }
77
85
 
78
86
  // src/Description.tsx
@@ -194,10 +202,7 @@ import {
194
202
  Select
195
203
  } from "antd";
196
204
  import { MinusCircleOutlined, PlusOutlined } from "@ant-design/icons";
197
- import {
198
- useEffect as useEffect3,
199
- useState as useState4
200
- } from "react";
205
+ import { useEffect as useEffect3, useState as useState4 } from "react";
201
206
  import { upperFirst as upperFirst3 } from "lodash";
202
207
  function FormItem(props) {
203
208
  const [computedProps, setComputedProps] = useState4();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faasjs/ant-design",
3
- "version": "0.0.2-beta.349",
3
+ "version": "0.0.2-beta.350",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -27,7 +27,7 @@
27
27
  "lodash": "*",
28
28
  "react": "*",
29
29
  "react-dom": "*",
30
- "@faasjs/react": "^0.0.2-beta.349"
30
+ "@faasjs/react": "^0.0.2-beta.350"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@types/lodash": "*",