You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ga...@apache.org on 2017/07/04 08:31:33 UTC

[couchdb-fauxton] branch master updated: (#931) - Design Docs filtered view occasionally incorrect

This is an automated email from the ASF dual-hosted git repository.

garren pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb-fauxton.git


The following commit(s) were added to refs/heads/master by this push:
     new 74962a5  (#931) - Design Docs filtered view occasionally incorrect
74962a5 is described below

commit 74962a5d721f0bb9f1bd195cbc28b88d333f74ca
Author: Ryan Millay <ry...@gmail.com>
AuthorDate: Tue Jul 4 04:31:31 2017 -0400

    (#931) - Design Docs filtered view occasionally incorrect
    
    Resetting state when switching to ddocsOnly
---
 app/addons/documents/__tests__/query-options.test.js                 | 5 +++--
 .../documents/index-results/components/queryoptions/QueryOptions.js  | 1 +
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/app/addons/documents/__tests__/query-options.test.js b/app/addons/documents/__tests__/query-options.test.js
index fec4533..fc6c6ba 100644
--- a/app/addons/documents/__tests__/query-options.test.js
+++ b/app/addons/documents/__tests__/query-options.test.js
@@ -68,7 +68,7 @@ describe('QueryOptions', () => {
     expect(spy.calledOnce).toBe(true);
   });
 
-  it('calls queryOptionsFilterOnlyDdocs if ddocsOnly switches to true on new props', () => {
+  it('calls resetState and queryOptionsFilterOnlyDdocs if ddocsOnly switches to true on new props', () => {
     const spy = sinon.spy();
     const queryOptionsParams = {
       include_docs: false
@@ -76,6 +76,7 @@ describe('QueryOptions', () => {
 
     const wrapper = shallow(<QueryOptions
       ddocsOnly={false}
+      resetState={spy}
       queryOptionsFilterOnlyDdocs={spy}
       queryOptionsExecute={() => {}}
       resetPagination={() => {}}
@@ -89,7 +90,7 @@ describe('QueryOptions', () => {
     wrapper.instance().componentWillReceiveProps({
       ddocsOnly: true
     });
-    expect(spy.calledOnce).toBe(true);
+    expect(spy.calledTwice).toBe(true);
   });
 
   it('calls resetState if ddocsOnly switches to false on new props', () => {
diff --git a/app/addons/documents/index-results/components/queryoptions/QueryOptions.js b/app/addons/documents/index-results/components/queryoptions/QueryOptions.js
index 7d8b963..0c8058c 100644
--- a/app/addons/documents/index-results/components/queryoptions/QueryOptions.js
+++ b/app/addons/documents/index-results/components/queryoptions/QueryOptions.js
@@ -42,6 +42,7 @@ export default class QueryOptions extends React.Component {
     } = this.props;
 
     if (!ddocsOnly && nextProps.ddocsOnly) {
+      resetState();
       queryOptionsFilterOnlyDdocs();
     } else if (ddocsOnly && !nextProps.ddocsOnly) {
       resetState();

-- 
To stop receiving notification emails like this one, please contact
['"commits@couchdb.apache.org" <co...@couchdb.apache.org>'].