File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -37,16 +37,24 @@ async function get_z_options() {
3737
3838 return {
3939 userID,
40- kvStore : 'mem' ,
40+ kvStore : 'mem' as const ,
4141 server : PUBLIC_SERVER ,
4242 schema,
4343 mutators,
4444 context,
45- jwt : jwt || undefined
46- } as const ;
45+ auth : jwt || undefined
46+ } ;
4747}
4848
49+ // Top-level await to initialize Z with proper auth context
50+ // This works correctly when experimental.async is DISABLED
4951export const z = new Z ( await get_z_options ( ) ) ;
5052
53+ // Function to reinitialize Z with fresh JWT (call after login)
54+ export async function reinitializeZ ( ) {
55+ const options = await get_z_options ( ) ;
56+ z . build ( options ) ;
57+ }
58+
5159// Re-export queries and mutators for convenient access
5260export { queries , mutators } ;
Original file line number Diff line number Diff line change 11<script lang =" ts" >
2- import { page } from ' $app/stores ' ;
2+ import { page } from ' $app/state ' ;
33 import Bread from ' $lib/ui/Bread.svelte' ;
44 import { queries } from ' $lib/queries' ;
55 import { z } from ' $lib/zero.svelte' ;
6- import type { Snippet } from ' svelte' ;
76
8- const { children }: { children : Snippet } = $props ();
7+ const { children } = $props ();
98
109 const user = z .createQuery (queries .user .current ());
1110
7372 {#each links as link }
7473 <a
7574 href ={link .href }
76- aria-current ={$ page .url .pathname === link .href ? ' page' : undefined }
75+ aria-current ={page .url .pathname === link .href ? ' page' : undefined }
7776 >{link .label }</a
7877 >
7978 {/each }
Original file line number Diff line number Diff line change 4040
4141<div class =" stack" style:--gap =" 40px;" >
4242 <h1 >Hax</h1 >
43-
4443 <Table data ={hax .data } {columns } />
4544</div >
Original file line number Diff line number Diff line change 4949 <div class =" actions" >
5050 <a href =" /admin/targets/init" class =" button go_button" >Create Target</a >
5151 </div >
52-
5352 <Table data ={targets .data } {columns } />
5453</div >
Original file line number Diff line number Diff line change 11<script lang =" ts" >
2- import { page } from ' $app/stores ' ;
2+ import { page } from ' $app/state ' ;
33 import { queries } from ' $lib/queries' ;
44 import { z } from ' $lib/zero.svelte' ;
55
6262 <nav class =" sidebar-nav" >
6363 <a
6464 href =" /dashboard"
65- aria-current ={$page .url .pathname === ' /dashboard'
66- ? ' page'
67- : undefined }>Battles</a
65+ aria-current ={page .url .pathname === ' /dashboard' ? ' page' : undefined }
66+ >Battles</a
6867 >
6968 <a
7069 href =" /history"
71- aria-current ={$ page .url .pathname === ' /history' ? ' page' : undefined }
70+ aria-current ={page .url .pathname === ' /history' ? ' page' : undefined }
7271 >History</a
7372 >
7473 <a
7574 href =" /settings"
76- aria-current ={$ page .url .pathname === ' /settings' ? ' page' : undefined }
75+ aria-current ={page .url .pathname === ' /settings' ? ' page' : undefined }
7776 >Settings</a
7877 >
7978 {#if user .data ?.role === ' syntax' }
8079 <a
8180 href =" /admin/"
82- aria-current ={$ page .url .pathname .startsWith (' /admin' )
81+ aria-current ={page .url .pathname .startsWith (' /admin' )
8382 ? ' page'
8483 : undefined }>Admin</a
8584 >
Original file line number Diff line number Diff line change @@ -6,11 +6,12 @@ const config = {
66 // Consult https://svelte.dev/docs/kit/integrations
77 // for more information about preprocessors
88 preprocess : vitePreprocess ( ) ,
9- compilerOptions : {
10- experimental : {
11- async : true
12- }
13- } ,
9+ // Disabled: experimental.async breaks SvelteKit client-side navigation
10+ // compilerOptions: {
11+ // experimental: {
12+ // async: true
13+ // }
14+ // },
1415
1516 kit : {
1617 adapter : adapter ( ) ,
You can’t perform that action at this time.
0 commit comments