midudev / la-velada-web-oficial

Web oficial de La Velada IV de Ibai Llanos
https://lavelada.es
Other
1.37k stars 621 forks source link

Fix bug caused by using dom/selector in inline scripts, which breaks `CalendarButton` and `TwitchLiveBox` components #949

Closed pjmartorell closed 4 months ago

pjmartorell commented 4 months ago

Descripción

Fix bug caused by using dom/selector in inline scripts, which breaks CalendarButton and TwitchLiveBoxcomponents. Reverts some changes of https://github.com/midudev/la-velada-web-oficial/pull/934.

Problema solucionado

Browser raises the following error when trying to import { $ } from "@/lib/dom-selector". This error breaks the Agregar al calendario button. This issue only appears in is:inline scripts. Regular <script> tags are not affected by this because are processed and bundled by Astro (see this).

Captura de pantalla 2024-05-06 a les 21 49 20

Cambios propuestos

Using querySelector() fixes the issue. See the following demos before and after below.

Capturas de pantalla (si corresponde)

Before: https://github.com/midudev/la-velada-web-oficial/assets/345520/ae68394c-f10a-470f-8699-3a9510f07e35

After: https://github.com/midudev/la-velada-web-oficial/assets/345520/ba75c832-20c5-4038-8155-3d807081b9ea

Comprobación de cambios

Impacto potencial

Contexto adicional

Tested on MacOS Sonoma 14.4.1 and Chrome 124.0.6367.119 (latest version)

Enlaces útiles

vercel[bot] commented 4 months ago

@pjmartorell is attempting to deploy a commit to the midudev pro Team on Vercel.

A member of the Team first needs to authorize it.

AlejandroSuero commented 4 months ago

https://github.com/midudev/la-velada-web-oficial/blob/358f0de15966202c6b45ff40af3e15f5d1b3d224/src/components/TwitchLiveBox.astro#L43-L70

@pjmartorell He importado este componente y también da problemas al ser is:insline, por si puedes añadirlo a la PR

pjmartorell commented 4 months ago

https://github.com/midudev/la-velada-web-oficial/blob/358f0de15966202c6b45ff40af3e15f5d1b3d224/src/components/TwitchLiveBox.astro#L43-L70

@pjmartorell He importado este componente y también da problemas al ser is:insline, por si puedes añadirlo a la PR

hecho 👍