pollination-react-io 1.92.3 → 1.92.4

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/build/index.js CHANGED
@@ -47724,22 +47724,28 @@ var GetGeometry = function (_a) {
47724
47724
  var _g = React.useState(), selection = _g[0], setSelection = _g[1];
47725
47725
  var _h = React.useState(), subscribe = _h[0], setSubscribe = _h[1];
47726
47726
  var _j = React.useState(), preview = _j[0], setPreview = _j[1];
47727
+ // Config only on bootstrap
47728
+ var initialConfig = React.useMemo(function () {
47729
+ if (!optionsConfig)
47730
+ return undefined;
47731
+ return optionsConfig;
47732
+ }, []);
47727
47733
  // pollination-react-io hooks
47728
47734
  var _k = useGetGeometry(), host = _k.host, geometry = _k.geometry, getGeometry = _k.getGeometry;
47729
47735
  // set selection and subscribe on props change
47730
47736
  React.useEffect(function () {
47731
- if (!optionsConfig)
47737
+ if (!initialConfig)
47732
47738
  return;
47733
- var sel = Boolean(optionsConfig) && typeof optionsConfig !== 'undefined' &&
47734
- typeof optionsConfig.selection !== 'undefined' &&
47735
- typeof optionsConfig.selection.selected !== 'undefined' ? optionsConfig.selection.selected : false;
47736
- var sub = Boolean(optionsConfig) && typeof optionsConfig !== 'undefined' &&
47737
- typeof optionsConfig.subscribe !== 'undefined' &&
47738
- typeof optionsConfig.subscribe.selected !== 'undefined' ? optionsConfig.subscribe.selected : false;
47739
+ var sel = Boolean(initialConfig) && typeof initialConfig !== 'undefined' &&
47740
+ typeof initialConfig.selection !== 'undefined' &&
47741
+ typeof initialConfig.selection.selected !== 'undefined' ? initialConfig.selection.selected : false;
47742
+ var sub = Boolean(initialConfig) && typeof initialConfig !== 'undefined' &&
47743
+ typeof initialConfig.subscribe !== 'undefined' &&
47744
+ typeof initialConfig.subscribe.selected !== 'undefined' ? initialConfig.subscribe.selected : false;
47739
47745
  // Do not trigger prev props - for streamlit
47740
47746
  setSelection(sel);
47741
47747
  setSubscribe(sub);
47742
- }, [optionsConfig]);
47748
+ }, [initialConfig]);
47743
47749
  React.useEffect(function () {
47744
47750
  // Send data only after the first click
47745
47751
  if (!geometry || !setParentState || !isClicked)
@@ -47837,10 +47843,10 @@ var GetGeometry = function (_a) {
47837
47843
  },
47838
47844
  },
47839
47845
  ].filter(function (o) {
47840
- if (!optionsConfig)
47846
+ if (!initialConfig)
47841
47847
  return true;
47842
- return typeof optionsConfig[o.id] === 'undefined' ? true :
47843
- typeof optionsConfig[o.id].show === 'undefined' ? true : optionsConfig[o.id].show;
47848
+ return typeof initialConfig[o.id] === 'undefined' ? true :
47849
+ typeof initialConfig[o.id].show === 'undefined' ? true : initialConfig[o.id].show;
47844
47850
  }),
47845
47851
  }] : undefined, asButtons: true, label: buttonLabel, helpText: "Get ".concat(selection ? 'selected ' : '', " geometry").concat(subscribe ? ' continuously' : '', ".") }));
47846
47852
  };