Skip to content

Commit

Permalink
Fix edge snippet fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
TsayAdobe committed Dec 10, 2024
1 parent 847d448 commit ddf1dc2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions acrobat/blocks/dc-converter-widget/dc-converter-widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,15 +234,17 @@ export default async function init(element) {
const preRenderDropZone = !isLimitExhausted && !isRedirection;

const INLINE_SNIPPET = widget.querySelector(':scope > section#edge-snippet');
if (INLINE_SNIPPET) {
if (INLINE_SNIPPET && INLINE_SNIPPET.childNodes.length > 0) {
if (!isLimitExhausted) {
widgetContainer.dataset.rendered = 'true';
widgetContainer.appendChild(...INLINE_SNIPPET.childNodes);
performance.mark('milo-move-snippet');
}
widget.removeChild(INLINE_SNIPPET);
} else if (preRenderDropZone) {
const response = await fetch(DC_GENERATE_CACHE_URL || `${DC_DOMAIN}/dc-generate-cache/dc-hosted-${DC_GENERATE_CACHE_VERSION}/${VERB}-${pageLang}.html`);
const cacheHost = new URL(WIDGET_ENV);
cacheHost.pathname = '';
const response = await fetch(DC_GENERATE_CACHE_URL || `${cacheHost}dc-generate-cache/dc-hosted-${DC_GENERATE_CACHE_VERSION}/${VERB}-${pageLang}.html`);
switch (response.status) {
case 200: {
const template = await response.text();
Expand Down

0 comments on commit ddf1dc2

Please sign in to comment.