cleanup and consistently don't getNextPage at beginning

This commit is contained in:
howard-stearns 2018-06-06 15:24:54 -07:00
parent 335aeaeb38
commit 8185d1b5f5
4 changed files with 10 additions and 12 deletions

View file

@ -43,7 +43,6 @@ Column {
property var http: null;
HifiConstants { id: hifi }
//FIXME ListModel { id: suggestions; }
Component.onCompleted: suggestions.getFirstPage();
HifiModels.PSFListModel {
id: suggestions;
@ -57,7 +56,6 @@ Column {
endpoint: '/api/v1/user_stories?' + options.join('&');
itemsPerPage: 3;
processPage: function (data) {
console.log('FIXME processPage', suggestions.listModelName, JSON.stringify(data));
return data.user_stories.map(makeModelData);
};
listModelName: actions;
@ -85,7 +83,7 @@ Column {
data.details.connections = 4;
data.action = 'announcement';
}
var fixme = {
return {
place_name: name,
username: data.username || "",
path: data.path || "",
@ -103,8 +101,6 @@ Column {
searchText: [name].concat(tags, description || []).join(' ').toUpperCase()
};
console.log('fixme makeModelData', JSON.stringify(fixme));
return fixme;
}
function identity(x) {
return x;
@ -238,7 +234,7 @@ Column {
highlightMoveDuration: -1;
highlightMoveVelocity: -1;
currentIndex: -1;
onAtXEndChanged: { console.log('FIXME onAtXEndChanged', actions, scroll.atXEnd, scroll.atXBeginning); if (scroll.atXEnd && !scroll.atXBeginning) { suggestions.getNextPage(); } }
onAtXEndChanged: { if (scroll.atXEnd && !scroll.atXBeginning) { suggestions.getNextPage(); } }
spacing: 12;
width: parent.width;

View file

@ -780,7 +780,11 @@ Rectangle {
model: connectionsUserModel.model;
Connections {
target: connectionsTable.flickableItem;
onAtYEndChanged: if (connectionsTable.flickableItem.atYEnd) { connectionsUserModel.getNextPage(); }
onAtYEndChanged: {
if (connectionsTable.flickableItem.atYEnd && !connectionsTable.flickableItem.atYBeginning) {
connectionsUserModel.getNextPage();
}
}
}
// This Rectangle refers to each Row in the connectionsTable.

View file

@ -400,7 +400,7 @@ Item {
}
}
onAtYEndChanged: {
if (transactionHistory.atYEnd) {
if (transactionHistory.atYEnd && !transactionHistory.atYBeginning) {
console.log("User scrolled to the bottom of 'Recent Activity'.");
transactionHistoryModel.getNextPage();
}

View file

@ -79,8 +79,7 @@ Item {
var processed;
console.debug('handlePage', listModelName, error, JSON.stringify(response));
function fail(message) {
console.warn("Warning", listModelName, JSON.stringify(message));
console.log('FIXME fail setting currentPageToRetrieve to -1', listModelName);
console.warn("Warning page fail", listModelName, JSON.stringify(message));
currentPageToRetrieve = -1;
requestPending = false;
delayedClear = false;
@ -97,7 +96,6 @@ Item {
}
processed = processPage(response.data || response);
if (response.total_pages && (response.total_pages === currentPageToRetrieve)) {
console.log('fixme hanglePage set currentPageToRetrieve to -1', listModelName, 'response.total_pages:', response.total_pages, 'old currentPageToRetrieve:', currentPageToRetrieve);
currentPageToRetrieve = -1;
}
if (searchItemTest) {
@ -172,7 +170,7 @@ Item {
// ListView {
// id: theList
// model: thisPSFListModelId
// onAtYEndChanged: if (theList.atYEnd) { thisPSFListModelId.getNextPage(); }
// onAtYEndChanged: if (theList.atYEnd && !theList.atYBeginning) { thisPSFListModelId.getNextPage(); }
// ...}
property var getNextPage: function () {
console.log('fixme getNextPage', listModelName, requestPending, currentPageToRetrieve);