-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pagination: Fix disappearing pagination on back nav and refresh (#1060)
Previously, there were two pagination persistence bugs. Land on a vertical page with a query with results. Go to page 2. Go to page 3. Try to navigate backwards in browser history. You will go to page 1 instead of page 3. Land on a vertical page w a query w results. Go to page 2. Refresh the page. You will be on page 1 instead of page 2. Both of these related bugs were because we were defaulting to resetting pagination on any searchbar search. In 1, backwards navigation updates the query and the searchbar takes the updated query and searches. In 2, landing with a query query parameter is determined in the SearchBar component onCreate. To fix this, we add another value for the pre-existing queryTrigger global storage key, QUERY_PARAMETER, meaning the query was triggered by a query parameter. Note: as a result of this fix, we were no longer able to go from Page 2 to Page 1. This is because of another bug, where navigating backwards in history from presence of a query param to absence of the param will not erase the parameter in storage. This is fixed for the pagination param here but should be addressed more widely in SLAP-616. J=SLAP-610 TEST=manual Test on a local Jambo HH Theme site attached to a local dist of the SDK. Test on a local site using the SDK directly. Test that navigating on a vertical to Page 2 and then Page 3 allows you to navigate back in browser history to Page 2 and Page 1 respectively. Test that navigating to a page and then refreshing maintains pagination offset. (IE Test that query params for search-offset work as intended). Test that navigating to a page and then searching another query in the searchbar /will/ reset pagination (and remove the associated query parameter). Test that queryTrigger in the liveapi request in all the situations are null. Test that with defaultInitialSearch set, queryTrigger still sends as 'initialize' in the liveapi request.
- Loading branch information
Showing
6 changed files
with
68 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/** @module QueryTriggers */ | ||
|
||
/** | ||
* QueryTriggers is an ENUM of the possible triggers for a | ||
* query update. | ||
* | ||
* @enum {string} | ||
*/ | ||
export default { | ||
INITIALIZE: 'initialize', | ||
QUERY_PARAMETER: 'query-parameter' | ||
}; |
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