Skip to content

Commit ec222d9

Browse files
committed
Revert "fix: revert parse-community#1706 which introduced new database index requirements for pagination (parse-community#1800)"
This reverts commit 689df7c.
1 parent 447b046 commit ec222d9

File tree

2 files changed

+47
-20
lines changed

2 files changed

+47
-20
lines changed

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,27 @@ Changelogs are separated by release type for better overview.
44

55
## [Stable Releases][log_release]
66

7+
<<<<<<< HEAD
78
These are the official, stable releases that you can use in your production environments.
89

910
> ### “Stable for production!”
11+
=======
12+
## Improvements
13+
- 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)
14+
- Docker image use now node 12 version [#1788](https://github.com/parse-community/parse-dashboard/pull/1788)
15+
- CI now pushes docker images to Docker Hub (Corey Baker) [#1781](https://github.com/parse-community/parse-dashboard/pull/1781)
16+
- Add CI check to add changelog entry (Manuel Trezza) [#1764](https://github.com/parse-community/parse-dashboard/pull/1764)
17+
- Refactor: uniform issue templates across repos (Manuel Trezza) [#1767](https://github.com/parse-community/parse-dashboard/pull/1767)
18+
- fix: date cell value not selected on double clicks (fn-faisal) [#1730](https://github.com/parse-community/parse-dashboard/pull/1730)
19+
20+
## Fixes
21+
- 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)
22+
- 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)
23+
- Fixed UI for a field containing an array of pointers (Prerna Mehra) [#1776](https://github.com/parse-community/parse-dashboard/pull/1776)
24+
- Fixed bug when editing or copying a field containing an array of pointers [#1770](https://github.com/parse-community/parse-dashboard/issues/1770) (Prerna Mehra) [#1771](https://github.com/parse-community/parse-dashboard/pull/1771)
25+
- Modernize CI (Manuel Trezza) [#1789](https://github.com/parse-community/parse-dashboard/pull/1789)
26+
- ci: Remove parse-server dev dependency (Manuel Trezza) [#1796](https://github.com/parse-community/parse-dashboard/pull/1796)
27+
>>>>>>> parent of 689df7c (fix: revert #1706 which introduced new database index requirements for pagination (#1800))
1028
1129
Details:
1230
- Stability: *stable*

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

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -706,6 +706,14 @@ class Browser extends DashboardView {
706706
query.ascending(field)
707707
}
708708

709+
if (field !== 'objectId') {
710+
if (sortDir === '-') {
711+
query.addDescending('objectId');
712+
} else {
713+
query.addAscending('objectId');
714+
}
715+
}
716+
709717
query.limit(MAX_ROWS_FETCHED);
710718
this.excludeFields(query, source);
711719

@@ -783,37 +791,38 @@ class Browser extends DashboardView {
783791
let className = this.props.params.className;
784792
let source = this.state.relation || className;
785793
let query = queryFromFilters(source, this.state.filters);
786-
if (this.state.ordering !== '-createdAt') {
794+
let field = this.state.ordering;
795+
let sortDir = field[0] === '-' ? '-' : '+';
796+
field = field[0] === '-' ? field.slice(1) : field;
797+
if (this.state.ordering !== '-objectId' && this.state.ordering !== 'objectId') {
787798
// Construct complex pagination query
788799
let equalityQuery = queryFromFilters(source, this.state.filters);
789-
let field = this.state.ordering;
790-
let ascending = true;
791800
let comp = this.state.data[this.state.data.length - 1].get(field);
792-
if (field === 'objectId' || field === '-objectId') {
793-
comp = this.state.data[this.state.data.length - 1].id;
794-
}
795-
if (field[0] === '-') {
796-
field = field.substr(1);
801+
802+
if (sortDir === '-') {
797803
query.lessThan(field, comp);
798-
ascending = false;
804+
equalityQuery.lessThan('objectId', this.state.data[this.state.data.length - 1].id);
799805
} else {
800806
query.greaterThan(field, comp);
807+
equalityQuery.greaterThan('objectId', this.state.data[this.state.data.length - 1].id);
801808
}
802-
if (field === 'createdAt') {
803-
equalityQuery.greaterThan('createdAt', this.state.data[this.state.data.length - 1].get('createdAt'));
804-
} else {
805-
equalityQuery.lessThan('createdAt', this.state.data[this.state.data.length - 1].get('createdAt'));
806-
equalityQuery.equalTo(field, comp);
807-
}
809+
equalityQuery.equalTo(field, comp);
808810
query = Parse.Query.or(query, equalityQuery);
809-
if (ascending) {
810-
query.ascending(this.state.ordering);
811+
if (sortDir === '-') {
812+
query.descending(field);
813+
query.addDescending('objectId');
811814
} else {
812-
query.descending(this.state.ordering.substr(1));
815+
query.ascending(field);
816+
query.addAscending('objectId');
813817
}
814818
} else {
815-
query.lessThan('createdAt', this.state.data[this.state.data.length - 1].get('createdAt'));
816-
query.addDescending('createdAt');
819+
if (sortDir === '-') {
820+
query.lessThan('objectId', this.state.data[this.state.data.length - 1].id);
821+
query.addDescending('objectId');
822+
} else {
823+
query.greaterThan('objectId', this.state.data[this.state.data.length - 1].id);
824+
query.addAscending('objectId');
825+
}
817826
}
818827
query.limit(MAX_ROWS_FETCHED);
819828
this.excludeFields(query, source);

0 commit comments

Comments
 (0)