fix localstorage error

This commit is contained in:
2025-12-03 11:40:08 -05:00
parent 0889f81664
commit 5a92020dae
4 changed files with 23 additions and 18 deletions

View File

@@ -150,10 +150,9 @@ impl MathApp {
let data = get_localstorage().get_item(DATA_NAME).ok()??;
let (commit, cached_data) = crate::misc::hashed_storage_read(&data)?;
if commit == unsafe { std::mem::transmute::<&str, crate::misc::HashBytes>(build::SHORT_COMMIT) } {
tracing::info!("Reading decompression cache. Bytes: {}", cached_data.len());
return Some(cached_data.to_vec());
return Some(cached_data);
} else {
None
}
@@ -161,14 +160,8 @@ impl MathApp {
fn load_functions() -> Option<FunctionManager> {
let data = get_localstorage().get_item(FUNC_NAME).ok()??;
if crate::misc::HASH_LENGTH >= data.len() {
return None;
}
// TODO: stabilize FunctionManager serialize so it can persist across builds
let (commit, func_data) = crate::misc::hashed_storage_read(&data)?;
if commit == unsafe { std::mem::transmute::<&str, &[u8]>(build::SHORT_COMMIT) } {
tracing::info!("Reading previous function data");
let function_manager: FunctionManager = bincode::deserialize(&func_data).ok()?;