garrensmith commented on a change in pull request #971: Refactor 
documents/mango addon to use Redux
URL: https://github.com/apache/couchdb-fauxton/pull/971#discussion_r138633718
 
 

 ##########
 File path: app/addons/documents/index-results/reducers.js
 ##########
 @@ -85,17 +86,27 @@ export default function resultsState (state = 
initialState, action) {
       });
 
     case ActionTypes.INDEX_RESULTS_REDUX_NEW_RESULTS:
+      let selectedLayout = state.selectedLayout;
+      // Change layout if it's set to METADATA because this option is not 
available for Mango queries
+      if (action.docType === Constants.INDEX_RESULTS_DOC_TYPE.MANGO_QUERY) {
+        if (state.selectedLayout === Constants.LAYOUT_ORIENTATION.METADATA) {
+          selectedLayout = Constants.LAYOUT_ORIENTATION.TABLE;
+        }
+      }
       return Object.assign({}, state, {
         docs: action.docs,
         isLoading: false,
         isEditable: true, //TODO: determine logic for this
         fetchParams: Object.assign({}, state.fetchParams, action.params),
         pagination: Object.assign({}, state.pagination, {
           canShowNext: action.canShowNext
-        })
+        }),
+        docType: action.docType,
+        selectedLayout: selectedLayout
       });
 
     case ActionTypes.INDEX_RESULTS_REDUX_CHANGE_LAYOUT:
+      console.log('Reducing to ', action.layout);
 
 Review comment:
   Can you remove
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to