File tree Expand file tree Collapse file tree
admin/attendance/apprentices Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22 import { resolve } from ' $app/paths' ;
33 import { goto } from ' $app/navigation' ;
44 import { navigating } from ' $app/state' ;
5- import { SvelteSet } from ' svelte/reactivity' ;
5+ import { SvelteSet , SvelteMap } from ' svelte/reactivity' ;
66 import type { ApprenticeAttendanceStats } from ' $lib/types/attendance' ;
77 import type { Cohort } from ' $lib/airtable/sveltekit-wrapper' ;
88
1717
1818 // Group cohorts by prefix and sort
1919 const groupedCohorts = $derived .by (() => {
20- const groups = new Map <string , Cohort []>();
20+ const groups = new SvelteMap <string , Cohort []>();
2121
2222 for (const cohort of cohorts ) {
2323 // For MLX cohorts, group them all under "MLX"
2727 groups .set (mlxKey , []);
2828 }
2929 groups .get (mlxKey )! .push (cohort );
30- } else {
30+ }
31+ else {
3132 // Extract prefix (e.g., "FAC29" from "FAC29.2")
3233 const prefix = cohort .name .match (/ ^ ([A-Z ] + \d * )/ )?.[1 ] || cohort .name ;
3334
6364 })
6465 .map (([prefix , cohorts ]) => ({
6566 prefix ,
66- cohorts: cohorts .sort ((a , b ) => a .name .localeCompare (b .name ))
67+ cohorts: cohorts .sort ((a , b ) => a .name .localeCompare (b .name )),
6768 }));
6869 });
6970
138139 if (allSelected ) {
139140 // Deselect all in group
140141 groupCohortIds .forEach (id => localSelectedCohorts .delete (id ));
141- } else {
142+ }
143+ else {
142144 // Select all in group
143145 groupCohortIds .forEach (id => localSelectedCohorts .add (id ));
144146 }
Original file line number Diff line number Diff line change 55
66 let { data }: { data: PageData } = $props ();
77
8- // Make events reactive
9- let events = $state (data .events );
8+ // Make events reactive - need $state for mutation in event handlers
9+ // eslint-disable-next-line svelte/prefer-writable-derived
10+ let events = $state <typeof data .events >([]);
1011
1112 // Update events when data changes (page navigation)
1213 $effect (() => {
13- events = data .events ;
14+ events = [ ... data .events ] ;
1415 });
1516
1617 // Check-in state for authenticated users
You can’t perform that action at this time.
0 commit comments