@measured/puck 0.11.0-canary.d22150a → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/dist/index.js +7 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -32775,10 +32775,12 @@ var import_react_spinners4 = require("react-spinners");
32775
32775
  var import_jsx_runtime13 = require("react/jsx-runtime");
32776
32776
  var getClassName10 = get_class_name_factory_default("ExternalInput", styles_module_default6);
32777
32777
  var getClassNameModal = get_class_name_factory_default("ExternalInputModal", styles_module_default6);
32778
+ var dataCache = {};
32778
32779
  var ExternalInput = ({
32779
32780
  field,
32780
32781
  onChange,
32781
- value = null
32782
+ value = null,
32783
+ name
32782
32784
  }) => {
32783
32785
  const { mapProp = (val) => val } = field || {};
32784
32786
  const [data, setData] = (0, import_react29.useState)([]);
@@ -32797,13 +32799,14 @@ var ExternalInput = ({
32797
32799
  }, [data]);
32798
32800
  (0, import_react29.useEffect)(() => {
32799
32801
  (() => __async(void 0, null, function* () {
32800
- const listData = yield field.fetchList();
32802
+ const listData = dataCache[name] || (yield field.fetchList());
32801
32803
  if (listData) {
32802
32804
  setData(listData);
32803
32805
  setIsLoading(false);
32806
+ dataCache[name] = listData;
32804
32807
  }
32805
32808
  }))();
32806
- }, [field]);
32809
+ }, []);
32807
32810
  return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
32808
32811
  "div",
32809
32812
  {
@@ -32912,6 +32915,7 @@ var ExternalField = ({
32912
32915
  children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
32913
32916
  ExternalInput,
32914
32917
  {
32918
+ name,
32915
32919
  field: __spreadProps(__spreadValues({}, validField), {
32916
32920
  // DEPRECATED
32917
32921
  placeholder: ((_a = deprecatedField.adaptor) == null ? void 0 : _a.name) ? `Select from ${deprecatedField.adaptor.name}` : validField.placeholder,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@measured/puck",
3
- "version": "0.11.0-canary.d22150a",
3
+ "version": "0.11.0",
4
4
  "private": false,
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",