@mmapp/react 0.1.0-alpha.24 → 0.1.0-alpha.26

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
@@ -7443,7 +7443,7 @@ var NodeErrorBoundary = class extends import_react44.default.Component {
7443
7443
  return this.props.children;
7444
7444
  }
7445
7445
  };
7446
- function useDataSources(dataSources, resolver, scope) {
7446
+ function useDataSources(dataSources, resolver, scope, fetchVersion = 0) {
7447
7447
  const [results, setResults] = (0, import_react44.useState)({});
7448
7448
  const mountedRef = (0, import_react44.useRef)(true);
7449
7449
  (0, import_react44.useEffect)(() => {
@@ -7475,7 +7475,7 @@ function useDataSources(dataSources, resolver, scope) {
7475
7475
  }
7476
7476
  };
7477
7477
  fetchAll();
7478
- }, [dataSources, resolver]);
7478
+ }, [dataSources, resolver, fetchVersion]);
7479
7479
  return results;
7480
7480
  }
7481
7481
  async function fetchDataSource(ds, resolver, scope) {
@@ -7652,11 +7652,11 @@ var NodeRenderer = ({ node, fallback }) => {
7652
7652
  }, []);
7653
7653
  const localState = sharedLocal.state;
7654
7654
  const handleSetLocal = sharedLocal.setLocal;
7655
- const [, setFetchVersion] = (0, import_react44.useState)(0);
7655
+ const [fetchVersion, setFetchVersion] = (0, import_react44.useState)(0);
7656
7656
  const handleRefreshQuery = (0, import_react44.useCallback)(() => {
7657
7657
  setFetchVersion((v) => v + 1);
7658
7658
  }, []);
7659
- const dsResults = useDataSources(node.dataSources, resolver, parentScope);
7659
+ const dsResults = useDataSources(node.dataSources, resolver, parentScope, fetchVersion);
7660
7660
  const primaryInstance = Object.values(dsResults).find((r) => r.instance)?.instance;
7661
7661
  const primarySlug = node.dataSources?.find((ds) => ds.type === "workflow")?.slug;
7662
7662
  const actionScope = (0, import_react44.useMemo)(() => {
@@ -7705,6 +7705,9 @@ var NodeRenderer = ({ node, fallback }) => {
7705
7705
  actionScope
7706
7706
  }), [dsResults, localState, parentScope, actionScope, playerCtx?.auth]);
7707
7707
  const enrichedScope = (0, import_react44.useMemo)(() => {
7708
+ if (!node.dataSources?.length) {
7709
+ return scope;
7710
+ }
7708
7711
  const handleCreate = () => {
7709
7712
  if (primarySlug && resolver) {
7710
7713
  const fields = {};
@@ -7754,12 +7757,11 @@ var NodeRenderer = ({ node, fallback }) => {
7754
7757
  ...scope,
7755
7758
  $action: enrichedAction,
7756
7759
  $instance: enrichedInstance,
7757
- // Also add at top-level for direct access
7758
7760
  handleCreate,
7759
7761
  handleUpdate,
7760
7762
  setSearch
7761
7763
  };
7762
- }, [scope, primarySlug, resolver, handleRefreshQuery, handleSetLocal]);
7764
+ }, [scope, primarySlug, resolver, handleRefreshQuery, handleSetLocal, node.dataSources, localState]);
7763
7765
  if (node.visible_when) {
7764
7766
  const ctx = buildEvalContext(enrichedScope);
7765
7767
  const visible = evaluateExpression2(node.visible_when, ctx);
package/dist/index.mjs CHANGED
@@ -55,7 +55,7 @@ import {
55
55
  useMutation,
56
56
  usePlayerContext,
57
57
  useQuery
58
- } from "./chunk-XWBUADY2.mjs";
58
+ } from "./chunk-T3LKT45Z.mjs";
59
59
  import {
60
60
  ScopeContext,
61
61
  buildLoopScope,
@@ -2539,7 +2539,7 @@ var NodeErrorBoundary = class extends import_react12.default.Component {
2539
2539
  return this.props.children;
2540
2540
  }
2541
2541
  };
2542
- function useDataSources(dataSources, resolver, scope) {
2542
+ function useDataSources(dataSources, resolver, scope, fetchVersion = 0) {
2543
2543
  const [results, setResults] = (0, import_react12.useState)({});
2544
2544
  const mountedRef = (0, import_react12.useRef)(true);
2545
2545
  (0, import_react12.useEffect)(() => {
@@ -2571,7 +2571,7 @@ function useDataSources(dataSources, resolver, scope) {
2571
2571
  }
2572
2572
  };
2573
2573
  fetchAll();
2574
- }, [dataSources, resolver]);
2574
+ }, [dataSources, resolver, fetchVersion]);
2575
2575
  return results;
2576
2576
  }
2577
2577
  async function fetchDataSource(ds, resolver, scope) {
@@ -2748,11 +2748,11 @@ var NodeRenderer = ({ node, fallback }) => {
2748
2748
  }, []);
2749
2749
  const localState = sharedLocal.state;
2750
2750
  const handleSetLocal = sharedLocal.setLocal;
2751
- const [, setFetchVersion] = (0, import_react12.useState)(0);
2751
+ const [fetchVersion, setFetchVersion] = (0, import_react12.useState)(0);
2752
2752
  const handleRefreshQuery = (0, import_react12.useCallback)(() => {
2753
2753
  setFetchVersion((v) => v + 1);
2754
2754
  }, []);
2755
- const dsResults = useDataSources(node.dataSources, resolver, parentScope);
2755
+ const dsResults = useDataSources(node.dataSources, resolver, parentScope, fetchVersion);
2756
2756
  const primaryInstance = Object.values(dsResults).find((r) => r.instance)?.instance;
2757
2757
  const primarySlug = node.dataSources?.find((ds) => ds.type === "workflow")?.slug;
2758
2758
  const actionScope = (0, import_react12.useMemo)(() => {
@@ -2801,6 +2801,9 @@ var NodeRenderer = ({ node, fallback }) => {
2801
2801
  actionScope
2802
2802
  }), [dsResults, localState, parentScope, actionScope, playerCtx?.auth]);
2803
2803
  const enrichedScope = (0, import_react12.useMemo)(() => {
2804
+ if (!node.dataSources?.length) {
2805
+ return scope;
2806
+ }
2804
2807
  const handleCreate = () => {
2805
2808
  if (primarySlug && resolver) {
2806
2809
  const fields = {};
@@ -2850,12 +2853,11 @@ var NodeRenderer = ({ node, fallback }) => {
2850
2853
  ...scope,
2851
2854
  $action: enrichedAction,
2852
2855
  $instance: enrichedInstance,
2853
- // Also add at top-level for direct access
2854
2856
  handleCreate,
2855
2857
  handleUpdate,
2856
2858
  setSearch
2857
2859
  };
2858
- }, [scope, primarySlug, resolver, handleRefreshQuery, handleSetLocal]);
2860
+ }, [scope, primarySlug, resolver, handleRefreshQuery, handleSetLocal, node.dataSources, localState]);
2859
2861
  if (node.visible_when) {
2860
2862
  const ctx = buildEvalContext(enrichedScope);
2861
2863
  const visible = evaluateExpression(node.visible_when, ctx);
@@ -23,7 +23,7 @@ import {
23
23
  resolveBinding,
24
24
  usePlayerContext,
25
25
  useTheme
26
- } from "../chunk-XWBUADY2.mjs";
26
+ } from "../chunk-T3LKT45Z.mjs";
27
27
  import {
28
28
  ScopeContext,
29
29
  buildLoopScope,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mmapp/react",
3
- "version": "0.1.0-alpha.24",
3
+ "version": "0.1.0-alpha.26",
4
4
  "description": "React integration for the MindMatrix Player — hooks, components, and WebSocket bridge for browser-side workflow engines",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",