You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ro...@apache.org on 2014/10/12 00:48:28 UTC
fauxton commit: updated refs/heads/master to f9360c1
Repository: couchdb-fauxton
Updated Branches:
refs/heads/master 0af75cbf3 -> f9360c1fd
fix for duplicate results showing up after searches
The backbone models passed to the Views.AllDocsList have different ids,
so for some views (e.g. searches on all-docs or reduced view searches)
are adding more and more results after pressing the search button
multiple times.
closes COUCHDB-2376
Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/f9360c1f
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/f9360c1f
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/f9360c1f
Branch: refs/heads/master
Commit: f9360c1fd54db55bd593d93241e549a9fc44aef5
Parents: 0af75cb
Author: Benjamin Keen <be...@gmail.com>
Authored: Fri Oct 10 13:24:33 2014 -0700
Committer: Robert Kowalski <ro...@kowalski.gd>
Committed: Sun Oct 12 00:48:01 2014 +0200
----------------------------------------------------------------------
app/addons/documents/views.js | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/f9360c1f/app/addons/documents/views.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/views.js b/app/addons/documents/views.js
index 8db2e3c..23720f4 100644
--- a/app/addons/documents/views.js
+++ b/app/addons/documents/views.js
@@ -661,7 +661,15 @@ function(app, FauxtonAPI, Components, Documents, Databases, Views, QueryOptions,
if (this.bulkDeleteDocsCollection) {
isChecked = this.bulkDeleteDocsCollection.get(doc.id);
}
- this.rows[doc.get('id')] = this.insertView("table.all-docs tbody", new this.nestedView({
+
+ // the location of the ID attribute varies depending on the model. Also, for reduced view searches, the ID isn't
+ // available so we use Backbone's own unique ID
+ var id = _.has(doc, 'id') ? doc.id : doc.get('id');
+ if (_.isUndefined(id)) {
+ id = doc.cid;
+ }
+
+ this.rows[id] = this.insertView("table.all-docs tbody", new this.nestedView({
model: doc,
checked: isChecked
}));