@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.
package/dist/react.mjs CHANGED
@@ -3434,11 +3434,9 @@ function EmptySlotHint({
3434
3434
  }
3435
3435
  var ComponentContext = createContext(null);
3436
3436
  function useLiveComposerProps(layoutNodeId, props) {
3437
- const [live, setLive] = useState(props);
3438
- useEffect(() => {
3439
- setLive(props);
3440
- }, [props]);
3437
+ const [patch, setPatch] = useState(null);
3441
3438
  useEffect(() => {
3439
+ setPatch(null);
3442
3440
  const matchesNode = (nodeId) => {
3443
3441
  if (nodeId && layoutNodeId && String(nodeId) !== String(layoutNodeId)) {
3444
3442
  return false;
@@ -3448,15 +3446,15 @@ function useLiveComposerProps(layoutNodeId, props) {
3448
3446
  const applyField = (fieldName, value, nodeId) => {
3449
3447
  if (!fieldName || typeof fieldName !== "string") return;
3450
3448
  if (!matchesNode(nodeId)) return;
3451
- setLive((prev) => ({ ...prev, [fieldName]: value }));
3449
+ setPatch((prev) => ({ ...prev || {}, [fieldName]: value }));
3452
3450
  };
3453
3451
  const applyProps = (nextProps, nodeId) => {
3454
3452
  if (!nextProps || typeof nextProps !== "object" || Array.isArray(nextProps)) {
3455
3453
  return;
3456
3454
  }
3457
3455
  if (!matchesNode(nodeId)) return;
3458
- setLive((prev) => ({
3459
- ...prev,
3456
+ setPatch((prev) => ({
3457
+ ...prev || {},
3460
3458
  ...nextProps
3461
3459
  }));
3462
3460
  };
@@ -3485,7 +3483,7 @@ function useLiveComposerProps(layoutNodeId, props) {
3485
3483
  window.removeEventListener("message", onMessage);
3486
3484
  };
3487
3485
  }, [layoutNodeId]);
3488
- return live;
3486
+ return patch ? { ...props, ...patch } : props;
3489
3487
  }
3490
3488
  function useComponentProps() {
3491
3489
  const context = useContext(ComponentContext);
@@ -3784,9 +3782,10 @@ function ComposerInlineField({
3784
3782
  event.stopPropagation();
3785
3783
  },
3786
3784
  onClick: (event) => {
3785
+ if (!isComposerEditMode()) return;
3787
3786
  const link = event.target?.closest?.("a");
3788
3787
  if (link) event.preventDefault();
3789
- if (render && isComposerEditMode()) {
3788
+ if (render) {
3790
3789
  setEditing(true);
3791
3790
  }
3792
3791
  },