fix: remove obsolete astro:after-swap listener
which can be triggered in Astro 5.0 even with Swup, causing duplicate initialization
This commit is contained in:
parent
4a4c19a3ed
commit
1b4b859e87
2 changed files with 0 additions and 9 deletions
|
|
@ -61,7 +61,6 @@ let links: NavBarLink[] = navBarConfig.links.map(
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
function switchTheme() {
|
function switchTheme() {
|
||||||
if (localStorage.theme === 'dark') {
|
if (localStorage.theme === 'dark') {
|
||||||
document.documentElement.classList.remove('dark');
|
document.documentElement.classList.remove('dark');
|
||||||
|
|
@ -102,10 +101,6 @@ function loadButtonScript() {
|
||||||
}
|
}
|
||||||
|
|
||||||
loadButtonScript();
|
loadButtonScript();
|
||||||
|
|
||||||
document.addEventListener('astro:after-swap', () => {
|
|
||||||
loadButtonScript();
|
|
||||||
}, { once: false });
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{import.meta.env.PROD && <script is:inline define:vars={{scriptUrl: url('/pagefind/pagefind.js')}}>
|
{import.meta.env.PROD && <script is:inline define:vars={{scriptUrl: url('/pagefind/pagefind.js')}}>
|
||||||
|
|
|
||||||
|
|
@ -337,10 +337,6 @@ function init() {
|
||||||
/* Load settings when entering the site */
|
/* Load settings when entering the site */
|
||||||
init();
|
init();
|
||||||
|
|
||||||
/* Load settings before swapping */
|
|
||||||
/* astro:after-swap event happened before swap animation */
|
|
||||||
document.addEventListener('astro:after-swap', init);
|
|
||||||
|
|
||||||
const setup = () => {
|
const setup = () => {
|
||||||
// TODO: temp solution to change the height of the banner
|
// TODO: temp solution to change the height of the banner
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue