Repository: hasura/graphql-engine
File: console/src/components/Services/Data/TableBrowseRows/FilterActions.js (JavaScript)

Code before:
  };
};

const filterReducer = (state = defaultCurFilter, action) => {
  const i = action.index;
  const newFilter = {};
  switch (action.type) {
    case SET_DEFQUERY:
      const q = action.curQuery;
      if (
        'order_by' in q ||
        'limit' in q ||
        'offset' in q ||
        ('where' in q && '$and' in q.where)
      ) {
        const newCurFilterQ = {};
        newCurFilterQ.where =
          'where' in q && '$and' in q.where
            ? { $and: [...q.where.$and, { '': { '': '' } }] }
            : { ...defaultCurFilter.where };
        newCurFilterQ.order_by =
          'order_by' in q
            ? [...q.order_by, ...defaultCurFilter.order_by]
            : [...defaultCurFilter.order_by];
        newCurFilterQ.limit =
          'limit' in q && q.limit ? q.limit : defaultCurFilter.limit;
        newCurFilterQ.offset =
          'offset' in q ? q.offset : defaultCurFilter.offset;
        return newCurFilterQ;
      }
      return defaultCurFilter;
    case SET_FILTERCOL:
      const oldColName = Object.keys(state.where.$and[i])[0];
      newFilter[action.name] = { ...state.where.$and[i][oldColName] };
      return {
        ...state,
        where: {
          $and: [
            ...state.where.$and.slice(0, i),
            newFilter,
            ...state.where.$and.slice(i + 1),
          ],
        },
      };
    case SET_FILTEROP:
      const colName = Object.keys(state.where.$and[i])[0];
      const oldOp = Object.keys(state.where.$and[i][colName])[0];
      newFilter[colName] = {};
      newFilter[colName][action.opName] = state.where.$and[i][colName][oldOp];
      return {
        ...state,

Review comment (suggestion):
Wouldn't this be the same thing?

```suggestion
           q.limit || defaultCurFilter.limit;
```

Code after:
  };
};

const filterReducer = (state = defaultCurFilter, action) => {
  const i = action.index;
  const newFilter = {};
  switch (action.type) {
    case SET_DEFQUERY:
      const q = action.curQuery;
      if (
        'order_by' in q ||
        'limit' in q ||
        'offset' in q ||
        ('where' in q && '$and' in q.where)
      ) {
        const newCurFilterQ = {};
        newCurFilterQ.where =
          'where' in q && '$and' in q.where
            ? { $and: [...q.where.$and, { '': { '': '' } }] }
            : { ...defaultCurFilter.where };
        newCurFilterQ.order_by =
          'order_by' in q
            ? [...q.order_by, ...defaultCurFilter.order_by]
            : [...defaultCurFilter.order_by];
        newCurFilterQ.limit = q.limit || defaultCurFilter.limit;
        newCurFilterQ.offset = q.offset || defaultCurFilter.offset;
        return newCurFilterQ;
      }
      return defaultCurFilter;
    case SET_FILTERCOL:
      const oldColName = Object.keys(state.where.$and[i])[0];
      newFilter[action.name] = { ...state.where.$and[i][oldColName] };
      return {
        ...state,
        where: {
          $and: [
            ...state.where.$and.slice(0, i),
            newFilter,
            ...state.where.$and.slice(i + 1),
          ],
        },
      };
    case SET_FILTEROP:
      const colName = Object.keys(state.where.$and[i])[0];
      const oldOp = Object.keys(state.where.$and[i][colName])[0];
      newFilter[colName] = {};
      newFilter[colName][action.opName] = state.where.$and[i][colName][oldOp];
      return {
        ...state,
        where: {
          $and: [