Fix 1503
This commit is contained in:
8
Elecciones-Web/frontend/public/bootstrap.js
vendored
8
Elecciones-Web/frontend/public/bootstrap.js
vendored
@@ -54,6 +54,14 @@
|
|||||||
// 4. Cargar el JS principal y esperar a que esté listo
|
// 4. Cargar el JS principal y esperar a que esté listo
|
||||||
await loadScript(jsUrl);
|
await loadScript(jsUrl);
|
||||||
|
|
||||||
|
console.log('Bootstrap: Intentando llamar a render...');
|
||||||
|
if (window.EleccionesWidgets && typeof window.EleccionesWidgets.render === 'function') {
|
||||||
|
console.log('Bootstrap: La función render existe. Llamando ahora.');
|
||||||
|
window.EleccionesWidgets.render();
|
||||||
|
} else {
|
||||||
|
console.error('Bootstrap: La función render no se encontró en window.EleccionesWidgets.');
|
||||||
|
}
|
||||||
|
|
||||||
// 5. Una vez cargado, llamar a la función de renderizado
|
// 5. Una vez cargado, llamar a la función de renderizado
|
||||||
if (window.EleccionesWidgets && typeof window.EleccionesWidgets.render === 'function') {
|
if (window.EleccionesWidgets && typeof window.EleccionesWidgets.render === 'function') {
|
||||||
window.EleccionesWidgets.render();
|
window.EleccionesWidgets.render();
|
||||||
|
|||||||
@@ -60,7 +60,9 @@ if (import.meta.env.DEV) {
|
|||||||
// --- MODO PRODUCCIÓN ---
|
// --- MODO PRODUCCIÓN ---
|
||||||
// Exponemos la función de renderizado para el bootstrap.js
|
// Exponemos la función de renderizado para el bootstrap.js
|
||||||
const renderWidgets = () => {
|
const renderWidgets = () => {
|
||||||
|
console.log('React: Se ha ejecutado renderWidgets.');
|
||||||
const widgetContainers = document.querySelectorAll('[data-elecciones-widget]');
|
const widgetContainers = document.querySelectorAll('[data-elecciones-widget]');
|
||||||
|
console.log(`React: Se encontraron ${widgetContainers.length} contenedores de widget.`);
|
||||||
widgetContainers.forEach(container => {
|
widgetContainers.forEach(container => {
|
||||||
const widgetName = (container as HTMLElement).dataset.eleccionesWidget;
|
const widgetName = (container as HTMLElement).dataset.eleccionesWidget;
|
||||||
if (widgetName && WIDGET_MAP[widgetName]) {
|
if (widgetName && WIDGET_MAP[widgetName]) {
|
||||||
|
|||||||
Reference in New Issue
Block a user