@uniweb/runtime 1.3.10 → 1.3.12

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/ssr.js CHANGED
@@ -769,6 +769,22 @@ function renderPage(page, website) {
769
769
  const sectionOverrideCSS = buildSectionOverrides(page.getAllBlocks(), appearance);
770
770
  return { renderedContent, sectionOverrideCSS };
771
771
  }
772
+ function failingSectionOf(page, message) {
773
+ const fails = (block2) => {
774
+ try {
775
+ renderToString(renderBlock(block2));
776
+ return false;
777
+ } catch (err) {
778
+ return err.message === message;
779
+ }
780
+ };
781
+ const deepest = (block2) => {
782
+ const child = (block2.childBlocks || []).find(fails);
783
+ return child ? deepest(child) : block2;
784
+ };
785
+ const block = page.getAllBlocks().find(fails);
786
+ return block ? deepest(block).type : null;
787
+ }
772
788
  function injectPageContent(html, renderedContent, page, options = {}) {
773
789
  let result = html;
774
790
  if (!result.includes('id="uniweb-appearance"')) {
@@ -1360,7 +1376,7 @@ function createPageRenderer({ website, shell }) {
1360
1376
  });
1361
1377
  return { outcome: missing ? "notFound" : "rendered", html, page, error: null };
1362
1378
  }
1363
- return { website, render };
1379
+ return { website, render, failingSection: (page, message) => failingSectionOf(page, message) };
1364
1380
  }
1365
1381
  async function prefetchAndHydrate({ website, content, route, locale = null, fetch: fetch2 = null, dev = false, prerender = "always" }) {
1366
1382
  if (!website?.dataStore) {