File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,20 @@ export default async function (parent, args) {
2929 let orderDirection = ( args . orderDirection || 'desc' ) . toUpperCase ( ) ;
3030 if ( ! [ 'ASC' , 'DESC' ] . includes ( orderDirection ) ) orderDirection = 'DESC' ;
3131
32- const orderQuery = uniq ( [ orderBy , ...ORDER_FIELDS ] )
32+ // Use a single extra field for deterministic ordering
33+ // depending on the realm (space or user)
34+ // This covers 100% of our use cases
35+ // Missing realm is coming from queries not used by our UI
36+ const orderByFields = [ orderBy ] ;
37+ if ( where [ 'space' ] ) {
38+ orderByFields . push ( 'user' ) ;
39+ } else if ( where [ 'user' ] ) {
40+ orderByFields . push ( 'space' ) ;
41+ } else {
42+ orderByFields . push ( 'last_vote' ) ;
43+ }
44+
45+ const orderQuery = uniq ( orderByFields )
3346 . map ( ( field : string ) => `l.${ field } ${ orderDirection } ` )
3447 . join ( ', ' ) ;
3548
You can’t perform that action at this time.
0 commit comments