Skip to content

How to refresh app post deploy #8665

Answered by geoffrich
chris-carrington asked this question in Q&A
Discussion options

You must be logged in to vote

You should be able to set version.pollInterval in your svelte.config.js. With this setting, SvelteKit will check for a new version of your app using the interval you set. For example, with the below config, it will check every 5 seconds (5000 ms).

const config = {
	kit: {
		adapter: adapter(),
		version: {
			pollInterval: 5000
		}
	}
};

If you've set pollInterval to a non-zero value, you can use the updated store to determine if a new version is available.

<script>
	import { updated } from '$app/stores';
</script>

<p>Updated: {$updated}</p>

If you want to force a reload whenever the app code has been updated, you can use data-sveltekit-reload like so in your root +layout.svelte:

<script>
	

Replies: 3 comments 15 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
15 replies
@whishkid
Comment options

@eltigerchino
Comment options

@whishkid
Comment options

@krishnaTORQUE
Comment options

@david-plugge
Comment options

Answer selected by dummdidumm
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
6 participants