@@ -6,17 +6,26 @@ import {
66 type PullRequest
77} from '$lib/forge/interface/types' ;
88import { createSelectByIds } from '$lib/state/customSelectors' ;
9- import { providesList , ReduxTag } from '$lib/state/tags' ;
9+ import { invalidatesList , providesList , ReduxTag } from '$lib/state/tags' ;
1010import { isDefined } from '@gitbutler/ui/utils/typeguards' ;
11- import { createEntityAdapter , type EntityState } from '@reduxjs/toolkit' ;
11+ import {
12+ createEntityAdapter ,
13+ type EntityState ,
14+ type ThunkDispatch ,
15+ type UnknownAction
16+ } from '@reduxjs/toolkit' ;
1217import type { ForgeListingService } from '$lib/forge/interface/forgeListingService' ;
1318import type { BackendApi , GitHubApi } from '$lib/state/clientState.svelte' ;
1419
1520export class GitHubListingService implements ForgeListingService {
1621 private api : ReturnType < typeof injectEndpoints > ;
1722 private backendApi : ReturnType < typeof injectBackendEndpoints > ;
1823
19- constructor ( gitHubApi : GitHubApi , backendApi : BackendApi ) {
24+ constructor (
25+ gitHubApi : GitHubApi ,
26+ backendApi : BackendApi ,
27+ private readonly dispatch : ThunkDispatch < any , any , UnknownAction >
28+ ) {
2029 this . api = injectEndpoints ( gitHubApi ) ;
2130 this . backendApi = injectBackendEndpoints ( backendApi ) ;
2231 }
@@ -52,8 +61,8 @@ export class GitHubListingService implements ForgeListingService {
5261 return results . filter ( isDefined ) ?? [ ] ;
5362 }
5463
55- async refresh ( projectId : string ) : Promise < void > {
56- await this . backendApi . endpoints . listPrs . fetch ( projectId , { forceRefetch : true } ) ;
64+ async refresh ( _projectId : string ) : Promise < void > {
65+ this . dispatch ( this . backendApi . util . invalidateTags ( [ invalidatesList ( ReduxTag . PullRequests ) ] ) ) ;
5766 }
5867}
5968
0 commit comments