Fixed long-running requests to be cancelled when users try to change tabs or contexts.
This commit is contained in:
@@ -16,6 +16,7 @@ mod tests {
|
||||
|
||||
assert_eq!(app.navigation_stack, vec![DEFAULT_ROUTE]);
|
||||
assert!(app.network_tx.is_none());
|
||||
assert!(!app.cancellation_token.is_cancelled());
|
||||
assert_eq!(app.error, HorizontallyScrollableText::default());
|
||||
assert!(app.response.is_empty());
|
||||
assert_eq!(app.server_tabs.index, 0);
|
||||
@@ -82,6 +83,19 @@ mod tests {
|
||||
assert!(app.is_routing);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_reset_cancellation_token() {
|
||||
let mut app = App::default();
|
||||
app.cancellation_token.cancel();
|
||||
|
||||
assert!(app.cancellation_token.is_cancelled());
|
||||
|
||||
let new_token = app.reset_cancellation_token();
|
||||
|
||||
assert!(!app.cancellation_token.is_cancelled());
|
||||
assert!(!new_token.is_cancelled());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_reset_tick_count() {
|
||||
let mut app = App {
|
||||
|
||||
Reference in New Issue
Block a user