diff --git a/Elecciones-Web/frontend/public/bootstrap.js b/Elecciones-Web/frontend/public/bootstrap.js index 743523e..d4c8aaa 100644 --- a/Elecciones-Web/frontend/public/bootstrap.js +++ b/Elecciones-Web/frontend/public/bootstrap.js @@ -63,8 +63,15 @@ } // 5. Una vez cargado, llamar a la función de renderizado + // 5. Una vez cargado, llamar a la función de renderizado + console.log('Bootstrap: JS principal cargado. Buscando EleccionesWidgets.render...'); + if (window.EleccionesWidgets && typeof window.EleccionesWidgets.render === 'function') { + console.log('Bootstrap: La función render() FUE ENCONTRADA. Se procederá a llamarla.'); window.EleccionesWidgets.render(); + } else { + console.error('Bootstrap: ERROR CRÍTICO - La función render() NO SE ENCONTRÓ en window.EleccionesWidgets.'); + console.log('Bootstrap: Contenido de window.EleccionesWidgets:', window.EleccionesWidgets); } } catch (error) { diff --git a/Elecciones-Web/frontend/src/main.tsx b/Elecciones-Web/frontend/src/main.tsx index b25799b..9788bcf 100644 --- a/Elecciones-Web/frontend/src/main.tsx +++ b/Elecciones-Web/frontend/src/main.tsx @@ -60,14 +60,24 @@ if (import.meta.env.DEV) { // --- MODO PRODUCCIÓN --- // Exponemos la función de renderizado para el bootstrap.js const renderWidgets = () => { - console.log('React: Se ha ejecutado renderWidgets.'); + console.log('%cReact: La función renderWidgets() ha sido EJECUTADA.', 'color: green; font-weight: bold;'); + const widgetContainers = document.querySelectorAll('[data-elecciones-widget]'); - console.log(`React: Se encontraron ${widgetContainers.length} contenedores de widget.`); + + console.log(`React: Se encontraron ${widgetContainers.length} contenedores con el atributo [data-elecciones-widget].`); + + if (widgetContainers.length === 0) { + console.warn('React: ADVERTENCIA - No se encontró ningún elemento en el DOM para renderizar un widget. Verifica que el HTML contenga