remove decompress font cache

This commit is contained in:
Simon Gardling 2025-12-05 23:54:31 -05:00
parent e497987573
commit 41b50eb893
Signed by: titaniumtown
GPG Key ID: 9AB28AC10ECE533D

View File

@ -135,15 +135,6 @@ impl MathApp {
tracing::info!("Web Info: {:?}", &cc.integration_info.web_info); tracing::info!("Web Info: {:?}", &cc.integration_info.web_info);
fn get_storage_decompressed() -> Option<Vec<u8>> {
let data = get_localstorage().get_item(DATA_NAME).ok()??;
let cached_data = crate::misc::hashed_storage_read(&data)?;
tracing::info!("Reading decompression cache. Bytes: {}", cached_data.len());
return Some(cached_data);
}
fn load_functions() -> Option<FunctionManager> { fn load_functions() -> Option<FunctionManager> {
let data = get_localstorage().get_item(FUNC_NAME).ok()??; let data = get_localstorage().get_item(FUNC_NAME).ok()??;
let func_data = crate::misc::hashed_storage_read(&data)?; let func_data = crate::misc::hashed_storage_read(&data)?;
@ -173,17 +164,6 @@ impl MathApp {
.read_to_end(&mut data) .read_to_end(&mut data)
.expect("unable to read compressed data"); .expect("unable to read compressed data");
#[cfg(target_arch = "wasm32")]
{
tracing::info!("Setting decompression cache");
let saved_data = crate::misc::hashed_storage_create(&data);
tracing::info!("Bytes: {}", saved_data.len());
get_localstorage()
.set_item(DATA_NAME, saved_data)
.expect("failed to set local storage cache");
}
bincode::deserialize(data.as_slice()).expect("unable to deserialize bincode") bincode::deserialize(data.as_slice()).expect("unable to deserialize bincode")
} }
@ -191,19 +171,7 @@ impl MathApp {
// Initialize fonts // Initialize fonts
// This used to be in the `update` method, but (after a ton of digging) this actually caused OOMs. that was a pain to debug // This used to be in the `update` method, but (after a ton of digging) this actually caused OOMs. that was a pain to debug
cc.egui_ctx.set_fonts({ cc.egui_ctx.set_fonts({ decompress_fonts() });
#[cfg(target_arch = "wasm32")]
if let Some(Ok(data)) =
get_storage_decompressed().map(|data| bincode::deserialize(data.as_slice()))
{
data
} else {
decompress_fonts()
}
#[cfg(not(target_arch = "wasm32"))]
decompress_fonts()
});
// Set dark mode by default // Set dark mode by default
// cc.egui_ctx.set_visuals(crate::style::style()); // cc.egui_ctx.set_visuals(crate::style::style());