return request id in list item functions, that way pending requests get canceled and init gets never called for outdated values of pandora.user.ui.find and its not needed to pass the value of query to init
This commit is contained in:
parent
1834b6efe1
commit
78003ad56f
1 changed files with 10 additions and 14 deletions
|
@ -82,11 +82,10 @@ pandora.ui.list = function() {
|
||||||
id: 'list',
|
id: 'list',
|
||||||
items: function(data, callback) {
|
items: function(data, callback) {
|
||||||
//Ox.Log('', 'data, pandora.Query.toObject', data, pandora.Query.toObject())
|
//Ox.Log('', 'data, pandora.Query.toObject', data, pandora.Query.toObject())
|
||||||
pandora.api.find(Ox.extend(data, {
|
return pandora.api.find(Ox.extend(data, {
|
||||||
query: pandora.user.ui.find,
|
query: pandora.user.ui.find,
|
||||||
keys: data.keys ? ['modified'].concat(data.keys) : void 0
|
keys: data.keys ? ['modified'].concat(data.keys) : void 0
|
||||||
}), callback);
|
}), callback);
|
||||||
return Ox.clone(data, true);
|
|
||||||
},
|
},
|
||||||
scrollbarVisible: true,
|
scrollbarVisible: true,
|
||||||
selected: pandora.user.ui.listSelection,
|
selected: pandora.user.ui.listSelection,
|
||||||
|
@ -161,10 +160,9 @@ pandora.ui.list = function() {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
items: function(data, callback) {
|
items: function(data, callback) {
|
||||||
pandora.api.find(Ox.extend(data, {
|
return pandora.api.find(Ox.extend(data, {
|
||||||
query: pandora.user.ui.find
|
query: pandora.user.ui.find
|
||||||
}), callback);
|
}), callback);
|
||||||
return Ox.clone(data, true);
|
|
||||||
},
|
},
|
||||||
keys: ['director', 'id', 'modified', 'posterRatio', 'title', 'year'],
|
keys: ['director', 'id', 'modified', 'posterRatio', 'title', 'year'],
|
||||||
selected: pandora.user.ui.listSelection,
|
selected: pandora.user.ui.listSelection,
|
||||||
|
@ -230,7 +228,7 @@ pandora.ui.list = function() {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
items: function(data, callback) {
|
items: function(data, callback) {
|
||||||
pandora.api.find(Ox.extend(data, {
|
return pandora.api.find(Ox.extend(data, {
|
||||||
query: pandora.user.ui.find,
|
query: pandora.user.ui.find,
|
||||||
clips: {
|
clips: {
|
||||||
query: pandora.getClipsQuery(),
|
query: pandora.getClipsQuery(),
|
||||||
|
@ -238,7 +236,6 @@ pandora.ui.list = function() {
|
||||||
keys: []
|
keys: []
|
||||||
}
|
}
|
||||||
}), callback);
|
}), callback);
|
||||||
return Ox.clone(data, true);
|
|
||||||
},
|
},
|
||||||
keys: ['clips', 'director', 'duration', 'id', 'modified', 'posterRatio', 'title', 'videoRatio', 'year'],
|
keys: ['clips', 'director', 'duration', 'id', 'modified', 'posterRatio', 'title', 'videoRatio', 'year'],
|
||||||
selected: pandora.user.ui.listSelection,
|
selected: pandora.user.ui.listSelection,
|
||||||
|
@ -347,14 +344,13 @@ pandora.ui.list = function() {
|
||||||
items: function(data, callback) {
|
items: function(data, callback) {
|
||||||
var clipsQuery = pandora.getClipsQuery(),
|
var clipsQuery = pandora.getClipsQuery(),
|
||||||
isClipsQuery = !!clipsQuery.conditions.length;
|
isClipsQuery = !!clipsQuery.conditions.length;
|
||||||
pandora.api.find(Ox.extend(data, Ox.extend({
|
return pandora.api.find(Ox.extend(data, Ox.extend({
|
||||||
query: pandora.user.ui.find
|
query: pandora.user.ui.find
|
||||||
}, isClipsQuery ? {clips: {
|
}, isClipsQuery ? {clips: {
|
||||||
query: clipsQuery,
|
query: clipsQuery,
|
||||||
items: 1000000,
|
items: 1000000,
|
||||||
keys: []
|
keys: []
|
||||||
}} : {})), callback);
|
}} : {})), callback);
|
||||||
return Ox.clone(data, true);
|
|
||||||
},
|
},
|
||||||
keys: ['clips', 'director', 'duration', 'id', 'modified', 'posterRatio', 'rendered', 'title', 'year'],
|
keys: ['clips', 'director', 'duration', 'id', 'modified', 'posterRatio', 'rendered', 'title', 'year'],
|
||||||
selected: pandora.user.ui.listSelection,
|
selected: pandora.user.ui.listSelection,
|
||||||
|
@ -410,15 +406,15 @@ pandora.ui.list = function() {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
init: function(data) {
|
init: function(data) {
|
||||||
var folder, list;
|
var find = pandora.user.ui.find, folder, list;
|
||||||
if (data.query.conditions.length == 0) {
|
if (find.conditions.length == 0) {
|
||||||
pandora.$ui.allItems.update(data.items);
|
pandora.$ui.allItems.update(data.items);
|
||||||
} else if (
|
} else if (
|
||||||
data.query.conditions.length == 1
|
find.conditions.length == 1
|
||||||
&& data.query.conditions[0].key == 'list'
|
&& find.conditions[0].key == 'list'
|
||||||
&& data.query.conditions[0].operator == '=='
|
&& find.conditions[0].operator == '=='
|
||||||
) {
|
) {
|
||||||
list = data.query.conditions[0].value;
|
list = find.conditions[0].value;
|
||||||
folder = pandora.getListData(list).folder;
|
folder = pandora.getListData(list).folder;
|
||||||
if (pandora.$ui.folderList[folder]) {
|
if (pandora.$ui.folderList[folder]) {
|
||||||
pandora.$ui.folderList[folder].value(
|
pandora.$ui.folderList[folder].value(
|
||||||
|
|
Loading…
Reference in a new issue