Properly ignore missing/empty runnables config
This commit is contained in:
parent
48a6fb9e84
commit
c54d6aff6c
1 changed files with 13 additions and 10 deletions
|
@ -79,17 +79,20 @@ impl<T: for<'a> Deserialize<'a> + PartialEq + 'static> TrackedFile<T> {
|
||||||
) -> Model<Self> {
|
) -> Model<Self> {
|
||||||
cx.new_model(move |cx| {
|
cx.new_model(move |cx| {
|
||||||
cx.spawn(|tracked_file, mut cx| async move {
|
cx.spawn(|tracked_file, mut cx| async move {
|
||||||
while let Some(new_contents) = tracker.next().await.filter(|s| !s.is_empty()) {
|
while let Some(new_contents) = tracker.next().await {
|
||||||
let Some(new_contents) = serde_json_lenient::from_str(&new_contents).log_err()
|
if !new_contents.trim().is_empty() {
|
||||||
else {
|
let Some(new_contents) =
|
||||||
continue;
|
serde_json_lenient::from_str(&new_contents).log_err()
|
||||||
};
|
else {
|
||||||
tracked_file.update(&mut cx, |tracked_file: &mut TrackedFile<T>, cx| {
|
continue;
|
||||||
if tracked_file.parsed_contents != new_contents {
|
|
||||||
tracked_file.parsed_contents = new_contents;
|
|
||||||
cx.notify();
|
|
||||||
};
|
};
|
||||||
})?;
|
tracked_file.update(&mut cx, |tracked_file: &mut TrackedFile<T>, cx| {
|
||||||
|
if tracked_file.parsed_contents != new_contents {
|
||||||
|
tracked_file.parsed_contents = new_contents;
|
||||||
|
cx.notify();
|
||||||
|
};
|
||||||
|
})?;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
anyhow::Ok(())
|
anyhow::Ok(())
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue