Skip to content

Commit

Permalink
Add prefetch to layout for events (#595)
Browse files Browse the repository at this point in the history
* add prefetch for events cuz it's slow as

* reword comment ✏️

* Update src/routes/+layout.svelte

Co-authored-by: Ethan Davidson <31261035+EthanThatOneKid@users.noreply.github.com>

Co-authored-by: Ethan Davidson <31261035+EthanThatOneKid@users.noreply.github.com>
  • Loading branch information
charliettaylor and EthanThatOneKid committed Sep 28, 2022
1 parent bd965d2 commit d56b4c6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/routes/+layout.svelte
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<script lang="ts">
import { prefetch } from '$app/navigation';
import { onMount } from 'svelte';
import Navbar from '$lib/components/nav/bar.svelte';
import Footer from '$lib/components/footer/footer.svelte';
import AcmToaster from '$lib/components/toaster/toaster.svelte';
import { AcmTheme, theme } from '$lib/public/legacy/theme';
import { onMount } from 'svelte';
function changeTheme(event: MediaQueryListEvent) {
theme.set(event.matches ? AcmTheme.Dark : AcmTheme.Light);
Expand All @@ -17,6 +18,10 @@
mediaList.addEventListener('change', changeTheme);
return () => mediaList.removeEventListener('change', changeTheme);
}
// prefetch improves the load time of the events page, see #530
// https://kit.svelte.dev/docs/modules#$app-navigation-prefetch
prefetch('/events');
});
</script>

Expand Down

1 comment on commit d56b4c6

@vercel
Copy link

@vercel vercel bot commented on d56b4c6 Sep 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.