Skip to content

Commit 1b4b859

Browse files
committed
fix: remove obsolete astro:after-swap listener
which can be triggered in Astro 5.0 even with Swup, causing duplicate initialization
1 parent 4a4c19a commit 1b4b859

File tree

2 files changed

+0
-9
lines changed

2 files changed

+0
-9
lines changed

src/components/Navbar.astro

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ let links: NavBarLink[] = navBarConfig.links.map(
6161
</div>
6262

6363
<script>
64-
6564
function switchTheme() {
6665
if (localStorage.theme === 'dark') {
6766
document.documentElement.classList.remove('dark');
@@ -102,10 +101,6 @@ function loadButtonScript() {
102101
}
103102

104103
loadButtonScript();
105-
106-
document.addEventListener('astro:after-swap', () => {
107-
loadButtonScript();
108-
}, { once: false });
109104
</script>
110105

111106
{import.meta.env.PROD && <script is:inline define:vars={{scriptUrl: url('/pagefind/pagefind.js')}}>

src/layouts/Layout.astro

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -337,10 +337,6 @@ function init() {
337337
/* Load settings when entering the site */
338338
init();
339339

340-
/* Load settings before swapping */
341-
/* astro:after-swap event happened before swap animation */
342-
document.addEventListener('astro:after-swap', init);
343-
344340
const setup = () => {
345341
// TODO: temp solution to change the height of the banner
346342
/*

0 commit comments

Comments
 (0)