File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -280,7 +280,12 @@ const sorter = (a, b) => {
280280
281281 // if there isnt 2 add paths, sort by del path
282282 if ( lower ( deletedId ( b ) , deletedId ( a ) ) ) return aFirst
283- return bFirst
283+ if ( lower ( deletedId ( a ) , deletedId ( b ) ) ) return bFirst
284+
285+ if ( lower ( createdId ( a ) , deletedId ( b ) ) ) return bFirst
286+ if ( lower ( deletedId ( a ) , createdId ( b ) ) ) return aFirst
287+
288+ return 0
284289}
285290
286291function sort ( changes /*: Array<RemoteChange> */ ) /*: void */ {
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ describe('remote change sort', () => {
1616 }
1717 const a = [ child , parent ]
1818 remoteChange . sort ( a )
19- a . should . deepEqual ( [ parent , child ] )
19+ a . should . deepEqual ( [ child , parent ] )
2020 } )
2121
2222 describe ( 'sorts deleted before created for the same path' , ( ) => {
@@ -152,15 +152,15 @@ describe('remote change sort', () => {
152152 // - conflicts before anything else on same id
153153 // - deletion before addition on same id
154154 changes . should . deepEqual ( [
155- alanInsuranceCardDeletion ,
156- alanInsuranceCardAddition ,
155+ edfContract3Deletion ,
157156 digipostBouyguesBill ,
158157 edfContract1ConflictCreation ,
159158 edfContract1Addition ,
160159 edfContract2ConflictCreation ,
161160 edfContract2Addition ,
162- edfContract3Deletion ,
163161 edfContract3Addition ,
162+ alanInsuranceCardDeletion ,
163+ alanInsuranceCardAddition ,
164164 netflixBillAddition ,
165165 photoAddition
166166 ] )
You can’t perform that action at this time.
0 commit comments