@contentful/experiences-core 3.8.4-beta.0 → 3.8.4-beta.2

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/esm/index.js CHANGED
@@ -2687,6 +2687,10 @@ const detachExperienceStyles = (experience) => {
2687
2687
  // conflicts between different breakpoint values from multiple nodes where the hash would be equal
2688
2688
  // - Adding wrapping pattern nodes IDs to avoid conflicts between similar nested patterns as those
2689
2689
  // could override each others CSS for some breakpoints just through the order of `<style>` tags in the DOM.
2690
+ // - We're only considering the regular CSS (not the visibility-specific one) but that doesn't cause an issue
2691
+ // since we already use the breakpointId (which is not used in CSR, see createStylesheetsForBuiltInStyles).
2692
+ // Theoretically, we could drop `generatedCss` from the hash generation and still be safe from conflicts (unless
2693
+ // the node IDs are similar but visibility is different?)
2690
2694
  const styleHash = md5(currentNodeIdsChain + breakpointId + generatedCss);
2691
2695
  // and prefix the className to make sure the value can be processed
2692
2696
  const className = `cf-${styleHash}`;
@@ -2919,6 +2923,11 @@ const resolveBackgroundImageBinding = ({ variableData, getBoundEntityById, dataS
2919
2923
  // '/lUERH7tX7nJTaPX6f0udB/fields/assetReference/~locale/fields/file/~locale'
2920
2924
  const [, uuid] = variableData.path.split('/');
2921
2925
  const binding = dataSource[uuid];
2926
+ // Safeguard against edge cases - we should not have bound style values that do not have a data source entry.
2927
+ // However, just in case, we handle it here as empty and allow the user to replace without errors.
2928
+ if (!binding) {
2929
+ return;
2930
+ }
2922
2931
  const boundEntity = getBoundEntityById(binding.sys.id);
2923
2932
  if (!boundEntity) {
2924
2933
  return;