@redneckz/wildless-cms-uni-blocks 0.14.867 → 0.14.868

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.
@@ -9898,7 +9898,7 @@
9898
9898
  '': '',
9899
9899
  };
9900
9900
 
9901
- const useSortProductBlocks = (parentBlock = {}) => {
9901
+ const useSortProductBlocks = (parentBlock) => {
9902
9902
  const [blocks, setBlocks] = useState(parentBlock.blocks ?? []);
9903
9903
  const sessionStore = useSessionStore();
9904
9904
  const offerIds = sessionStore?.offerIds || [];
@@ -9907,10 +9907,14 @@
9907
9907
  const blocksByOfferIds = offerIds
9908
9908
  .map((id) => blocksMap.get(id))
9909
9909
  .filter((block) => Boolean(block));
9910
- const tailBlocks = blocks.filter(({ __id = '' }) => !offerIds.includes(__id));
9910
+ const tailBlocks = parentBlock.blocks?.filter(({ __id = '' }) => !offerIds.includes(__id)) ?? [];
9911
9911
  return [...blocksByOfferIds, ...tailBlocks];
9912
- }, [blocks, offerIds]);
9913
- useEffect(() => setBlocks(sortedBlocks), []);
9912
+ }, [parentBlock, offerIds]);
9913
+ useEffect(() => {
9914
+ if (sortedBlocks.length) {
9915
+ setBlocks(sortedBlocks);
9916
+ }
9917
+ }, [parentBlock]);
9914
9918
  return blocks;
9915
9919
  };
9916
9920
 
@@ -11147,7 +11151,7 @@
11147
11151
  slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
11148
11152
  });
11149
11153
 
11150
- const packageVersion = "0.14.866";
11154
+ const packageVersion = "0.14.867";
11151
11155
 
11152
11156
  exports.Blocks = Blocks;
11153
11157
  exports.ContentPage = ContentPage;