Fixed long-running requests to be cancelled when users try to change tabs or contexts.

This commit is contained in:
Dark-Alex-17 committed 2023-08-08 10:50:07 -06:00
1 parent e253ca8359
commit a8f6a5398b
10 files changed
+299 -193

No files matched your search

+14
View File
@@ -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 {