Skip to content

Commit e9878d3

Browse files
author
christopherbrookes
committed
feat: revert PR #1706
1 parent 802c8fd commit e9878d3

File tree

2 files changed

+22
-30
lines changed

2 files changed

+22
-30
lines changed

CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@
88

99
## Improvements
1010
- Update sass to 5.0.0 and make docker image use node:lts-alpine (Corey Baker) [#1792](https://github.com/parse-community/parse-dashboard/pull/1792)
11-
- Docker image use now node 12 version [#1788](https://github.com/parse-community/parse-dashboard/pull/1788)
11+
- Docker image use now node 12 version (Christopher Brookes) [#1788](https://github.com/parse-community/parse-dashboard/pull/1788)
1212
- CI now pushes docker images to Docker Hub (Corey Baker) [#1781](https://github.com/parse-community/parse-dashboard/pull/1781)
1313
- Add CI check to add changelog entry (Manuel Trezza) [#1764](https://github.com/parse-community/parse-dashboard/pull/1764)
1414
- Refactor: uniform issue templates across repos (Manuel Trezza) [#1767](https://github.com/parse-community/parse-dashboard/pull/1767)
1515
- fix: date cell value not selected on double clicks (fn-faisal) [#1730](https://github.com/parse-community/parse-dashboard/pull/1730)
1616

1717
## Fixes
18+
- Revert PR [#1706](https://github.com/parse-community/parse-dashboard/pull/1706) which introduced new database index requirements for pagination and was a breaking change that can lead to database performance issues if database indices are not adapted (Christopher Brookes) [#1800](https://github.com/parse-community/parse-dashboard/pull/1800)
1819
- Fixed bug after creating new class, wrong CLP was shown for that class [#1784](https://github.com/parse-community/parse-dashboard/issues/1784) (Prerna Mehra) [#1785](https://github.com/parse-community/parse-dashboard/pull/1785)
1920
- Fixed bug when opening a big modal, modal content is not visible due to Sidebar (Prerna Mehra) [#1777](https://github.com/parse-community/parse-dashboard/pull/1778)
2021
- Fixed UI for a field containing an array of pointers (Prerna Mehra) [#1776](https://github.com/parse-community/parse-dashboard/pull/1776)

src/dashboard/Data/Browser/Browser.react.js

+20-29
Original file line numberDiff line numberDiff line change
@@ -647,14 +647,6 @@ class Browser extends DashboardView {
647647
query.ascending(field)
648648
}
649649

650-
if (field !== 'objectId') {
651-
if (sortDir === '-') {
652-
query.addDescending('objectId');
653-
} else {
654-
query.addAscending('objectId');
655-
}
656-
}
657-
658650
query.limit(MAX_ROWS_FETCHED);
659651
this.excludeFields(query, source);
660652

@@ -732,38 +724,37 @@ class Browser extends DashboardView {
732724
let className = this.props.params.className;
733725
let source = this.state.relation || className;
734726
let query = queryFromFilters(source, this.state.filters);
735-
let field = this.state.ordering;
736-
let sortDir = field[0] === '-' ? '-' : '+';
737-
field = field[0] === '-' ? field.slice(1) : field;
738-
if (this.state.ordering !== '-objectId' && this.state.ordering !== 'objectId') {
727+
if (this.state.ordering !== '-createdAt') {
739728
// Construct complex pagination query
740729
let equalityQuery = queryFromFilters(source, this.state.filters);
730+
let field = this.state.ordering;
731+
let ascending = true;
741732
let comp = this.state.data[this.state.data.length - 1].get(field);
742-
743-
if (sortDir === '-') {
733+
if (field === 'objectId' || field === '-objectId') {
734+
comp = this.state.data[this.state.data.length - 1].id;
735+
}
736+
if (field[0] === '-') {
737+
field = field.substr(1);
744738
query.lessThan(field, comp);
745-
equalityQuery.lessThan('objectId', this.state.data[this.state.data.length - 1].id);
739+
ascending = false;
746740
} else {
747741
query.greaterThan(field, comp);
748-
equalityQuery.greaterThan('objectId', this.state.data[this.state.data.length - 1].id);
749742
}
750-
equalityQuery.equalTo(field, comp);
751-
query = Parse.Query.or(query, equalityQuery);
752-
if (sortDir === '-') {
753-
query.descending(field);
754-
query.addDescending('objectId');
743+
if (field === 'createdAt') {
744+
equalityQuery.greaterThan('createdAt', this.state.data[this.state.data.length - 1].get('createdAt'));
755745
} else {
756-
query.ascending(field);
757-
query.addAscending('objectId');
746+
equalityQuery.lessThan('createdAt', this.state.data[this.state.data.length - 1].get('createdAt'));
747+
equalityQuery.equalTo(field, comp);
758748
}
759-
} else {
760-
if (sortDir === '-') {
761-
query.lessThan('objectId', this.state.data[this.state.data.length - 1].id);
762-
query.addDescending('objectId');
749+
query = Parse.Query.or(query, equalityQuery);
750+
if (ascending) {
751+
query.ascending(this.state.ordering);
763752
} else {
764-
query.greaterThan('objectId', this.state.data[this.state.data.length - 1].id);
765-
query.addAscending('objectId');
753+
query.descending(this.state.ordering.substr(1));
766754
}
755+
} else {
756+
query.lessThan('createdAt', this.state.data[this.state.data.length - 1].get('createdAt'));
757+
query.addDescending('createdAt');
767758
}
768759
query.limit(MAX_ROWS_FETCHED);
769760
this.excludeFields(query, source);

0 commit comments

Comments
 (0)