-
Notifications
You must be signed in to change notification settings - Fork 429
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix back navigation after POST form submission (#1014)
This commit fixes a bug where navigating back after submitting a POST form would not show the previous page. The bug was introduced in #949. The new cache API is async since it needs to access CacheStorage which is async. In that PR, getCachedSnapshot was changed to be async, but hasCachedSnapshot was not changed. This meant that getCachedSnapshot would always return a promise, which is truthy, and so hasCachedSnapshot which just checked that the return value was not null would always return true. The bug would show up when you tried to navigate back to a page after a post form submission. The form submission would clear the cache, but the restoration visit would think it had a cached snapshot and so would not issue a request. This meant that the page would not be restored and nothing would happen. There's a new test in navigation_tests.js that reproduces this bug. The fix is to make hasCachedSnapshot async and await it in the places where it is used.
- Loading branch information
Alberto Fernández-Capel
authored
Sep 28, 2023
1 parent
0ec99ae
commit c207f5b
Showing
3 changed files
with
15 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters