@@ -99,10 +99,23 @@ const selectSortedAccounts = createSelector(
9999 wipAtTop ?: boolean ,
100100 tags ?: string [ ]
101101 ) => tags ?? emptyList ,
102- ( accounts , sortMode , type , searchTerm , wipAtTop , tags ) => {
102+ (
103+ state : IRootState ,
104+ groupId : number ,
105+ type : AccountType | undefined ,
106+ sortMode : AccountSortMode ,
107+ searchTerm ?: string ,
108+ wipAtTop ?: boolean ,
109+ tags ?: string [ ] ,
110+ excludeLocalOnly ?: boolean
111+ ) => excludeLocalOnly ,
112+ ( accounts , sortMode , type , searchTerm , wipAtTop , tags , excludeLocalOnly ) => {
103113 const compareFunction = getAccountSortFunc ( sortMode , wipAtTop ) ;
104114 // TODO: this has optimization potential
105115 const filterFn = ( a : Account ) : boolean => {
116+ if ( excludeLocalOnly && isAccountOnlyLocal ( a ) ) {
117+ return false ;
118+ }
106119 if ( a . type === "clearing" && tags . length > 0 && a . tags ) {
107120 for ( const tag of tags ) {
108121 if ( ! a . tags . includes ( tag ) ) {
@@ -136,14 +149,18 @@ const selectSortedAccounts = createSelector(
136149
137150export const useSortedAccounts = < T extends AccountType > (
138151 groupId : number ,
139- sortMode : AccountSortMode ,
140- type ?: T ,
141- searchTerm ?: string ,
142- wipAtTop ?: boolean ,
143- tags : string [ ] = [ ]
152+ config : {
153+ type ?: T ;
154+ sortMode : AccountSortMode ;
155+ searchTerm ?: string ;
156+ wipAtTop ?: boolean ;
157+ excludeLocalOnly ?: boolean ;
158+ tags ?: string [ ] ;
159+ }
144160) : T extends "personal" ? PersonalAccount [ ] : T extends "clearing" ? ClearingAccount [ ] : Account [ ] => {
161+ const { sortMode, type, searchTerm, wipAtTop, excludeLocalOnly = false , tags = [ ] } = config ;
145162 return useSelector ( ( state : IRootState ) =>
146- selectSortedAccounts ( state , groupId , type , sortMode , searchTerm , wipAtTop , tags )
163+ selectSortedAccounts ( state , groupId , type , sortMode , searchTerm , wipAtTop , tags , excludeLocalOnly )
147164 ) as any ;
148165} ;
149166
0 commit comments