this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: capture card_dir() before spawn_blocking in review renderer

GlobalSignal reads require the Dioxus runtime; spawn_blocking runs on a
plain tokio thread. Capture the dir value in the async block (still on
the Dioxus runtime) before handing off to spawn_blocking.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

+10 -4
+10 -4
crates/tala/src/main.rs
··· 2002 2002 (queue, sidecar) 2003 2003 } 2004 2004 2005 - fn render_review_b64(source: &str, preamble: tala_typst::Preamble) -> Result<String, String> { 2006 - let result = tala_typst::render(&card_dir(), source, preamble, &[]).map_err(|e| e.to_string())?; 2005 + fn render_review_b64( 2006 + dir: &std::path::Path, 2007 + source: &str, 2008 + preamble: tala_typst::Preamble, 2009 + ) -> Result<String, String> { 2010 + let result = tala_typst::render(dir, source, preamble, &[]).map_err(|e| e.to_string())?; 2007 2011 2008 2012 let straight: Vec<u8> = result 2009 2013 .rgba ··· 2162 2166 (ReviewKind::FrontBack, _) => tala_typst::Preamble::ReviewFront, 2163 2167 (ReviewKind::Cloze, _) => tala_typst::Preamble::ReviewCloze, 2164 2168 }; 2169 + let dir = card_dir(); // capture in Dioxus runtime before spawn_blocking 2165 2170 tokio::task::spawn_blocking(move || { 2166 - render_review_b64(&item.source, preamble).unwrap_or_default() 2171 + render_review_b64(&dir, &item.source, preamble).unwrap_or_default() 2167 2172 }) 2168 2173 .await 2169 2174 .unwrap_or_default() ··· 2179 2184 sess.queue.get(*idx.read()).cloned() 2180 2185 }; 2181 2186 let Some(item) = item else { return None }; 2187 + let dir = card_dir(); // capture in Dioxus runtime before spawn_blocking 2182 2188 tokio::task::spawn_blocking(move || { 2183 - render_review_b64(&item.source, tala_typst::Preamble::Authoring).ok() 2189 + render_review_b64(&dir, &item.source, tala_typst::Preamble::Authoring).ok() 2184 2190 }) 2185 2191 .await 2186 2192 .ok()