@amplifyup/sdk 0.1.53 → 0.1.54

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.
@@ -2945,11 +2945,9 @@ var refreshEventTracking = () => getSDK().refreshEventTracking();
2945
2945
  getSDK();
2946
2946
  createContext(null);
2947
2947
  function useLiveComposerProps(layoutNodeId, props) {
2948
- const [live, setLive] = useState(props);
2949
- useEffect(() => {
2950
- setLive(props);
2951
- }, [props]);
2948
+ const [patch, setPatch] = useState(null);
2952
2949
  useEffect(() => {
2950
+ setPatch(null);
2953
2951
  const matchesNode = (nodeId) => {
2954
2952
  if (nodeId && layoutNodeId && String(nodeId) !== String(layoutNodeId)) {
2955
2953
  return false;
@@ -2959,15 +2957,15 @@ function useLiveComposerProps(layoutNodeId, props) {
2959
2957
  const applyField = (fieldName, value, nodeId) => {
2960
2958
  if (!fieldName || typeof fieldName !== "string") return;
2961
2959
  if (!matchesNode(nodeId)) return;
2962
- setLive((prev) => ({ ...prev, [fieldName]: value }));
2960
+ setPatch((prev) => ({ ...prev || {}, [fieldName]: value }));
2963
2961
  };
2964
2962
  const applyProps = (nextProps, nodeId) => {
2965
2963
  if (!nextProps || typeof nextProps !== "object" || Array.isArray(nextProps)) {
2966
2964
  return;
2967
2965
  }
2968
2966
  if (!matchesNode(nodeId)) return;
2969
- setLive((prev) => ({
2970
- ...prev,
2967
+ setPatch((prev) => ({
2968
+ ...prev || {},
2971
2969
  ...nextProps
2972
2970
  }));
2973
2971
  };
@@ -2996,7 +2994,7 @@ function useLiveComposerProps(layoutNodeId, props) {
2996
2994
  window.removeEventListener("message", onMessage);
2997
2995
  };
2998
2996
  }, [layoutNodeId]);
2999
- return live;
2997
+ return patch ? { ...props, ...patch } : props;
3000
2998
  }
3001
2999
  var usePathname = null;
3002
3000
  if (typeof window !== "undefined") {