ElyMark: renders asked of a failed page end at once (M-08)
The tally remembers why the page went down; until a load succeeds, render() ends each new request with that reason instead of calling a dead page. end_renders is a free function with a gpui test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2c19d027a6
commit
22d2d04d1e
8 files changed
+98
-35
No files matched your search
@@ -0,0 +1,18 @@
|
||||
use std::{cell::RefCell, rc::Rc};
|
||||
|
||||
use serde_json::Value;
|
||||
|
||||
#[gpui::test]
|
||||
fn each_owed_render_ends_once_with_the_reason(cx: &mut gpui::TestAppContext) {
|
||||
let got = Rc::new(RefCell::new(Vec::<(u8, Result<Value, String>)>::new()));
|
||||
let pending = (0..2)
|
||||
.map(|n| {
|
||||
let got = got.clone();
|
||||
Box::new(move |rendered, _: &mut gpui::App| got.borrow_mut().push((n, rendered))) as super::Rendered
|
||||
})
|
||||
.collect();
|
||||
cx.update(|cx| super::end_renders(pending, "denied", cx));
|
||||
cx.run_until_parked();
|
||||
let denied = || Err("denied".to_string());
|
||||
assert_eq!(*got.borrow(), [(0, denied()), (1, denied())]);
|
||||
}
|
||||
Reference in new issue
Block a user