I tested this by adding following code to the start of (voters)/results/+page.svelte, removing import for activeTab store and changing every $activeTab to activeTab.
import type {Snapshot} from './$types';
let activeTab = 0;
export const snapshot: Snapshot<number> = {
capture: () => activeTab,
restore: (value) => (activeTab = value)
};
The biggest difference compared to the store is that the active tab is persisted also when the page is refreshed. Otherwise it seems to be functionally same as the store. Visually there are two differences:
When coming back from viewing party Candidates tab is very briefly shown as active tab
After refreshing the first tab is shown as active tab until the data has been loaded
Of course it may be possible to fix these as this was only a quick test.
I tested this by adding following code to the start of
(voters)/results/+page.svelte
, removing import foractiveTab
store and changing every$activeTab
toactiveTab
.The biggest difference compared to the store is that the active tab is persisted also when the page is refreshed. Otherwise it seems to be functionally same as the store. Visually there are two differences:
Of course it may be possible to fix these as this was only a quick test.