pollination-react-io 1.92.1 → 1.92.3

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
@@ -38622,6 +38622,9 @@ var usePollinationPanel = function () {
38622
38622
  return;
38623
38623
  try {
38624
38624
  var message = panel.FetchSimulationFile(path, subfolder, SimulationFileType[SimulationFileType.status]);
38625
+ if (message.data === '') {
38626
+ console.log('[LOCAL RUN]: Status file not found');
38627
+ }
38625
38628
  var run = JSON.parse(message.data);
38626
38629
  return run;
38627
38630
  }
@@ -38640,6 +38643,9 @@ var usePollinationPanel = function () {
38640
38643
  return;
38641
38644
  try {
38642
38645
  var message = panel.FetchSimulationFile(path, subfolder, SimulationFileType[SimulationFileType.job]);
38646
+ if (message.data === '') {
38647
+ console.log('[LOCAL RUN]: Job file not found');
38648
+ }
38643
38649
  var localJob = JSON.parse(message.data);
38644
38650
  var job = (_a = localJob === null || localJob === void 0 ? void 0 : localJob.LocalJob) === null || _a === void 0 ? void 0 : _a.Job;
38645
38651
  job['author'] = (_b = localJob === null || localJob === void 0 ? void 0 : localJob.LocalJob) === null || _b === void 0 ? void 0 : _b.JobAuthor;
@@ -38660,6 +38666,9 @@ var usePollinationPanel = function () {
38660
38666
  return;
38661
38667
  try {
38662
38668
  var message = panel.FetchSimulationFile(path, subfolder, SimulationFileType[SimulationFileType.logs]);
38669
+ if (message.data === '') {
38670
+ console.log('[LOCAL RUN]: Log file not found');
38671
+ }
38663
38672
  return message.data;
38664
38673
  }
38665
38674
  catch (error) {
@@ -47707,21 +47716,16 @@ var GetModelActions;
47707
47716
  })(GetModelActions || (GetModelActions = {}));
47708
47717
 
47709
47718
  var GetGeometry = function (_a) {
47710
- var setParentState = _a.setParentState, optionsConfig = _a.optionsConfig, _b = _a.buttonLabel, buttonLabel = _b === void 0 ? 'Get Geometry' : _b, _c = _a.defaultKey, defaultKey = _c === void 0 ? 'get-geometry-btn' : _c;
47719
+ var setParentState = _a.setParentState, optionsConfig = _a.optionsConfig, _b = _a.buttonLabel, buttonLabel = _b === void 0 ? 'Get Geometry' : _b, _c = _a.defaultKey, defaultKey = _c === void 0 ? 'get-geometry-btn' : _c, _d = _a.useIcon, useIcon = _d === void 0 ? false : _d;
47711
47720
  var subscribeRef = React.useRef();
47712
47721
  var sendMessage = useSendMessage().sendMessage;
47713
- var _d = React.useState(performance.now().toString()), key = _d[0], setKey = _d[1];
47714
- var _e = React.useState(Boolean(optionsConfig) && typeof optionsConfig !== 'undefined' &&
47715
- typeof optionsConfig.selection !== 'undefined' &&
47716
- typeof optionsConfig.selection.selected !== 'undefined' ? optionsConfig.selection.selected : false), selection = _e[0], setSelection = _e[1];
47717
- var _f = React.useState(Boolean(optionsConfig) && typeof optionsConfig !== 'undefined' &&
47718
- typeof optionsConfig.subscribe !== 'undefined' &&
47719
- typeof optionsConfig.subscribe.selected !== 'undefined' ? optionsConfig.subscribe.selected : false), subscribe = _f[0], setSubscribe = _f[1];
47720
- var _g = React.useState(Boolean(optionsConfig) && typeof optionsConfig !== 'undefined' &&
47721
- typeof optionsConfig.preview !== 'undefined' &&
47722
- typeof optionsConfig.preview.selected !== 'undefined' ? optionsConfig.preview.selected : false), preview = _g[0], setPreview = _g[1];
47722
+ var _e = React.useState(performance.now().toString()), key = _e[0], setKey = _e[1];
47723
+ var _f = React.useState(false), isClicked = _f[0], setIsClicked = _f[1];
47724
+ var _g = React.useState(), selection = _g[0], setSelection = _g[1];
47725
+ var _h = React.useState(), subscribe = _h[0], setSubscribe = _h[1];
47726
+ var _j = React.useState(), preview = _j[0], setPreview = _j[1];
47723
47727
  // pollination-react-io hooks
47724
- var _h = useGetGeometry(), host = _h.host, geometry = _h.geometry, getGeometry = _h.getGeometry;
47728
+ var _k = useGetGeometry(), host = _k.host, geometry = _k.geometry, getGeometry = _k.getGeometry;
47725
47729
  // set selection and subscribe on props change
47726
47730
  React.useEffect(function () {
47727
47731
  if (!optionsConfig)
@@ -47737,7 +47741,8 @@ var GetGeometry = function (_a) {
47737
47741
  setSubscribe(sub);
47738
47742
  }, [optionsConfig]);
47739
47743
  React.useEffect(function () {
47740
- if (!geometry || !setParentState)
47744
+ // Send data only after the first click
47745
+ if (!geometry || !setParentState || !isClicked)
47741
47746
  return;
47742
47747
  var fr = new FileReader();
47743
47748
  fr.onload = function () {
@@ -47774,7 +47779,7 @@ var GetGeometry = function (_a) {
47774
47779
  clearInterval(subscribeRef.current);
47775
47780
  subscribeRef.current = undefined;
47776
47781
  }
47777
- }, [getGeometry, key, subscribe, subscribeRef]);
47782
+ }, [getGeometry, key, subscribe, subscribeRef, selection]);
47778
47783
  // selection and subscription
47779
47784
  React.useEffect(function () {
47780
47785
  // If selection is deactivated and subscription is active
@@ -47785,9 +47790,10 @@ var GetGeometry = function (_a) {
47785
47790
  setKey(performance.now().toString());
47786
47791
  }
47787
47792
  }, [selection]);
47788
- return (React__default["default"].createElement(SettingsButton, { onClick: function () {
47793
+ return (React__default["default"].createElement(SettingsButton, { icon: useIcon && undefined, onClick: function () {
47789
47794
  if (!getGeometry)
47790
47795
  return;
47796
+ setIsClicked(true);
47791
47797
  getGeometry(key, selection, true);
47792
47798
  }, disabled: typeof getGeometry === 'undefined',
47793
47799
  // @ts-ignore
@@ -56420,7 +56426,7 @@ var RunCard = function (_a) {
56420
56426
  if (run.status.finished_at)
56421
56427
  setStopRefresh(true);
56422
56428
  setIsReady(true);
56423
- },
56429
+ }
56424
56430
  }), run = _11.data, error = _11.error;
56425
56431
  var sendRun = React.useCallback(function (run) { return getValue(run); }, [getValue]);
56426
56432
  /**
@@ -56495,11 +56501,12 @@ var RunCard = function (_a) {
56495
56501
  setHover(__assign(__assign({}, emptyHover), (_a = {}, _a[defaultTab] = true, _a)));
56496
56502
  }, [defaultTab, emptyHover]);
56497
56503
  var localStudyURLname = React.useMemo(function () {
56504
+ var _a, _b;
56498
56505
  if (!localStudy)
56499
56506
  return;
56500
- return localStudy.name
56501
- .replace(/[^a-zA-Z0-9]/g, '')
56502
- .replace(/[ ()]/g, '');
56507
+ if (localStudy === null || localStudy === void 0 ? void 0 : localStudy.name)
56508
+ return 'hello';
56509
+ return (_b = (_a = localStudy === null || localStudy === void 0 ? void 0 : localStudy.name) === null || _a === void 0 ? void 0 : _a.replace(/[^a-zA-Z0-9]/g, '')) === null || _b === void 0 ? void 0 : _b.replace(/[ ()]/g, '');
56503
56510
  }, [localStudy]);
56504
56511
  /**
56505
56512
  * Rendering - if error