Change summary
crates/agent/src/history_store.rs | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
Detailed changes
@@ -212,7 +212,16 @@ impl HistoryStore {
fn load_recently_opened_entries(cx: &AsyncApp) -> Task<Result<Vec<HistoryEntryId>>> {
cx.background_spawn(async move {
let path = paths::data_dir().join(NAVIGATION_HISTORY_PATH);
- let contents = smol::fs::read_to_string(path).await?;
+ let contents = match smol::fs::read_to_string(path).await {
+ Ok(it) => it,
+ Err(e) if e.kind() == std::io::ErrorKind::NotFound => {
+ return Ok(Vec::new());
+ }
+ Err(e) => {
+ return Err(e)
+ .context("deserializing persisted agent panel navigation history");
+ }
+ };
let entries = serde_json::from_str::<Vec<SerializedRecentOpen>>(&contents)
.context("deserializing persisted agent panel navigation history")?
.into_iter()