mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-13 05:20:00 -08:00
[Client] Keep Archidekt listing pagination after a failed navigation
Only update list mode and the next-page link when a listing or deck response is accepted, so a failed deck navigation leaves the existing listing scrollable. Retry still re-issues the failed request.
This commit is contained in:
parent
8c751b4210
commit
51b2ed2412
1 changed files with 4 additions and 3 deletions
|
|
@ -99,7 +99,6 @@ void TabArchidekt::startRequest(QUrl url, RequestKind kind, int page)
|
||||||
requestUrl = url;
|
requestUrl = url;
|
||||||
requestKind = kind;
|
requestKind = kind;
|
||||||
requestedPage = page;
|
requestedPage = page;
|
||||||
isListMode = kind != RequestKind::Deck;
|
|
||||||
isLoadingMore = true;
|
isLoadingMore = true;
|
||||||
retryButton->hide();
|
retryButton->hide();
|
||||||
requestStatusLabel->setText(kind == RequestKind::Deck ? tr("Loading deck…") : tr("Loading decks…"));
|
requestStatusLabel->setText(kind == RequestKind::Deck ? tr("Loading deck…") : tr("Loading decks…"));
|
||||||
|
|
@ -580,7 +579,6 @@ void TabArchidekt::doSearchImmediate()
|
||||||
{
|
{
|
||||||
searchDebounceTimer->stop();
|
searchDebounceTimer->stop();
|
||||||
currentPage = 1;
|
currentPage = 1;
|
||||||
nextPageUrl.clear();
|
|
||||||
startRequest(QUrl(buildSearchUrl()), RequestKind::Search);
|
startRequest(QUrl(buildSearchUrl()), RequestKind::Search);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -598,7 +596,6 @@ void TabArchidekt::loadNextPage()
|
||||||
void TabArchidekt::actNavigatePage(QString url)
|
void TabArchidekt::actNavigatePage(QString url)
|
||||||
{
|
{
|
||||||
searchDebounceTimer->stop();
|
searchDebounceTimer->stop();
|
||||||
nextPageUrl.clear();
|
|
||||||
startRequest(QUrl(url), RequestKind::Deck);
|
startRequest(QUrl(url), RequestKind::Deck);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -670,6 +667,9 @@ void TabArchidekt::processTopDecksResponse(QJsonObject reply)
|
||||||
ArchidektDeckListingApiResponse deckData;
|
ArchidektDeckListingApiResponse deckData;
|
||||||
deckData.fromJson(reply);
|
deckData.fromJson(reply);
|
||||||
|
|
||||||
|
// An accepted listing restores list mode; a failed deck navigation leaves the listing usable.
|
||||||
|
isListMode = true;
|
||||||
|
|
||||||
// New search → clear everything
|
// New search → clear everything
|
||||||
if (requestKind == RequestKind::Search) {
|
if (requestKind == RequestKind::Search) {
|
||||||
listingsWidget = nullptr;
|
listingsWidget = nullptr;
|
||||||
|
|
@ -697,6 +697,7 @@ void TabArchidekt::processDeckResponse(QJsonObject reply)
|
||||||
|
|
||||||
// We're in single deck mode - disable infinite scroll
|
// We're in single deck mode - disable infinite scroll
|
||||||
isListMode = false;
|
isListMode = false;
|
||||||
|
nextPageUrl.clear();
|
||||||
|
|
||||||
// Clear existing results for single deck view
|
// Clear existing results for single deck view
|
||||||
listingsWidget = nullptr;
|
listingsWidget = nullptr;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue