You've already forked gpui-component
mirror of
https://github.com/librekeys/gpui-component.git
synced 2026-04-14 08:46:29 -07:00
story: Fix story panic when save state failed. (#1384)
Close #1383 --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: huacnlee <5518+huacnlee@users.noreply.github.com>
This commit is contained in:
@@ -49,8 +49,10 @@ pub fn init(cx: &mut App) {
|
||||
scrollbar_show: Some(cx.theme().scrollbar_show),
|
||||
};
|
||||
|
||||
let json = serde_json::to_string_pretty(&state).unwrap();
|
||||
std::fs::write(STATE_FILE, json).unwrap();
|
||||
if let Ok(json) = serde_json::to_string_pretty(&state) {
|
||||
// Ignore write errors - if STATE_FILE doesn't exist or can't be written, do nothing
|
||||
let _ = std::fs::write(STATE_FILE, json);
|
||||
}
|
||||
})
|
||||
.detach();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user