@ohhwells/bridge 0.1.127-next.351 → 0.1.127-next.352

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/index.cjs CHANGED
@@ -4946,23 +4946,26 @@ function applyAiFooterToDom(state, content) {
4946
4946
  hideTemplateFooter(templateFooter);
4947
4947
  return;
4948
4948
  }
4949
- let container = mounted2?.container;
4950
- if (!container || !container.isConnected) {
4951
- mounted2?.root.unmount();
4952
- container?.remove();
4953
- container = document.createElement("div");
4954
- container.setAttribute(CONTAINER_ATTR2, "");
4955
- container.setAttribute("data-ohw-section", "footer");
4956
- container.setAttribute("data-ohw-section-label", "Footer");
4957
- container.setAttribute("data-ohw-instance", "ai-footer");
4949
+ if (mounted2) {
4950
+ try {
4951
+ mounted2.root.unmount();
4952
+ } catch {
4953
+ }
4954
+ mounted2.container.remove();
4955
+ mounted2 = null;
4958
4956
  }
4957
+ const container = document.createElement("div");
4958
+ container.setAttribute(CONTAINER_ATTR2, "");
4959
+ container.setAttribute("data-ohw-section", "footer");
4960
+ container.setAttribute("data-ohw-section-label", "Footer");
4961
+ container.setAttribute("data-ohw-instance", "ai-footer");
4959
4962
  hideTemplateFooter(templateFooter);
4960
4963
  if (templateFooter?.parentElement) {
4961
4964
  templateFooter.insertAdjacentElement("afterend", container);
4962
- } else if (!container.isConnected) {
4965
+ } else {
4963
4966
  document.body.appendChild(container);
4964
4967
  }
4965
- const root = mounted2?.root ?? (0, import_client2.createRoot)(container);
4968
+ const root = (0, import_client2.createRoot)(container);
4966
4969
  const resolveMedia = (ref) => state.media?.[ref] ?? null;
4967
4970
  (0, import_react_dom2.flushSync)(() => {
4968
4971
  root.render(
@@ -29639,7 +29642,9 @@ function OhhwellsBridge() {
29639
29642
  if (deleted && document.querySelector("[data-ai-footer]")) {
29640
29643
  const state = parseAiFooterState(aiFooterRef.current);
29641
29644
  if (state?.tree) {
29642
- applyFooterTreeLocalRef.current?.(syncFooterTreeLinksFromDom(state.tree));
29645
+ applyFooterTreeLocalRef.current?.(syncFooterTreeLinksFromDom(state.tree), {
29646
+ remount: true
29647
+ });
29643
29648
  }
29644
29649
  }
29645
29650
  return deleted;