fix(js): reload stale popstate partials
When back/forward navigation receives an incompatible or unusable partial response, reload the current URL instead of leaving the previous UI stale. req: page_swap/005 req: page_swap/006 req: runtime/004
This commit is contained in:
@@ -145,7 +145,16 @@ fn runtime_exposes_page_swap_hooks() {
|
||||
assert!(source.contains("x-slhx-title"));
|
||||
assert!(source.contains("x-slhx-fingerprint"));
|
||||
assert!(source.contains("slhx:missing-content-slot"));
|
||||
assert!(source.contains("location.href = href"));
|
||||
assert!(source.contains("else location.href = href"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn runtime_popstate_failed_partials_reload_instead_of_stale_ui() {
|
||||
// req: page_swap/005 req: page_swap/006 req: runtime/004
|
||||
let source = slhx_js::RUNTIME_JS;
|
||||
|
||||
assert!(source.contains("if (mode === \"none\") location.reload();"));
|
||||
assert!(source.contains("if (root) navigateUrl(location.href, root, \"none\")"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user