99} from '@angular/core' ;
1010import { orderBy , query , where } from '@angular/fire/firestore' ;
1111import { MatDialog } from '@angular/material/dialog' ;
12- import { deepEqual } from '@firebase/util' ;
1312import { Observable , Subscription } from 'rxjs' ;
1413
1514import { ColumnDialogComponent } from '~components/column-dialog/column-dialog.component' ;
@@ -18,6 +17,7 @@ import { COLUMN_SORT_OPTIONS } from '~constants/forms.constants';
1817import { DialogActions } from '~enums/dialog-actions.enum' ;
1918import { ConfirmationDialog } from '~interfaces/confirmation-dialog.interface' ;
2019import { SortOption } from '~interfaces/sort-option.interface' ;
20+ import { Sort } from '~interfaces/sort.interface' ;
2121import { Application } from '~models/application.model' ;
2222import { Column } from '~models/column.model' ;
2323import { ApplicationsService } from '~services/applications/applications.service' ;
@@ -125,7 +125,7 @@ export class ColumnComponent implements OnChanges, OnDestroy {
125125 const isSortChange =
126126 currColumn &&
127127 prevColumn &&
128- ! deepEqual ( currColumn . applicationSort , prevColumn . applicationSort ) ;
128+ ! this . deepEqualSort ( currColumn . applicationSort , prevColumn . applicationSort ) ;
129129
130130 if ( currColumn && ( changes . column . isFirstChange ( ) || isColumnChange || isSortChange ) ) {
131131 this . selectedSortOption = this . sortOptions . find ( ( v ) =>
@@ -162,6 +162,22 @@ export class ColumnComponent implements OnChanges, OnDestroy {
162162 } ) ;
163163 }
164164
165+ private deepEqualSort ( a : Sort , b : Sort ) : boolean {
166+ if ( a === b ) {
167+ return true ;
168+ }
169+
170+ if ( ! a || ! b ) {
171+ return false ;
172+ }
173+
174+ if ( typeof a !== 'object' || typeof b !== 'object' ) {
175+ return false ;
176+ }
177+
178+ return a . direction === b . direction && a . field === b . field ;
179+ }
180+
165181 private initApplications ( ) : void {
166182 this . subscription ?. unsubscribe ( ) ;
167183 this . applications$ = this . applicationsService . collection$ (
0 commit comments