File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -286,6 +286,7 @@ fn approve_request(req: SectionRequest, requests: RwSignal<Vec<SectionRequest>>)
286286 let cohort = req. cohort . clone ( ) ;
287287 let pk = req. requester . clone ( ) ;
288288
289+ let relay = expect_context :: < RelayConnection > ( ) ;
289290 spawn_local ( async move {
290291 // Add cohort to user's whitelist entry
291292 match admin. add_to_whitelist ( & pk, & [ cohort. clone ( ) ] , & privkey) . await {
@@ -298,8 +299,7 @@ fn approve_request(req: SectionRequest, requests: RwSignal<Vec<SectionRequest>>)
298299 ) ;
299300
300301 // Publish kind-9000 (add user to group) as confirmation
301- let relay = expect_context :: < RelayConnection > ( ) ;
302- if let Some ( my_pk) = use_auth ( ) . pubkey ( ) . get_untracked ( ) {
302+ if let Some ( my_pk) = auth. pubkey ( ) . get_untracked ( ) {
303303 let now = ( js_sys:: Date :: now ( ) / 1000.0 ) as u64 ;
304304 let unsigned = nostr_core:: UnsignedEvent {
305305 pubkey : my_pk,
@@ -311,7 +311,6 @@ fn approve_request(req: SectionRequest, requests: RwSignal<Vec<SectionRequest>>)
311311 ] ,
312312 content : "Approved section access request" . to_string ( ) ,
313313 } ;
314- let auth = use_auth ( ) ;
315314 wasm_bindgen_futures:: spawn_local ( async move {
316315 if let Ok ( signed) = auth. sign_event_async ( unsigned) . await {
317316 relay. publish ( & signed) ;
Original file line number Diff line number Diff line change @@ -206,10 +206,10 @@ pub fn SettingsPage() -> impl IntoView {
206206 let toasts_ok = toasts_for_profile. clone ( ) ;
207207 let toasts_pub = toasts_for_profile. clone ( ) ;
208208 let toasts_err = toasts_for_profile. clone ( ) ;
209+ let relay = expect_context :: < RelayConnection > ( ) ;
209210 wasm_bindgen_futures:: spawn_local ( async move {
210211 match auth. sign_event_async ( unsigned) . await {
211212 Ok ( signed) => {
212- let relay = expect_context :: < RelayConnection > ( ) ;
213213 let saving_sig = profile_saving;
214214 let auth_for_ack = auth;
215215 let name_for_ack = name. clone ( ) ;
Original file line number Diff line number Diff line change @@ -120,10 +120,12 @@ pub fn SetupPage() -> impl IntoView {
120120 } ;
121121
122122 let trimmed_for_ack = trimmed. clone ( ) ;
123+ // Capture relay before spawn_local — reactive context is not
124+ // propagated into async tasks in Leptos 0.7.
125+ let relay = expect_context :: < RelayConnection > ( ) ;
123126 wasm_bindgen_futures:: spawn_local ( async move {
124127 match auth. sign_event_async ( unsigned) . await {
125128 Ok ( signed) => {
126- let relay = expect_context :: < RelayConnection > ( ) ;
127129 relay. publish ( & signed) ;
128130
129131 auth. set_profile ( Some ( trimmed_for_ack) , None ) ;
You can’t perform that action at this time.
0 commit comments