mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-11-30 01:17:37 +03:00
🔧 fix: update getGithubContext to only emit distinct values when baseBranch remoteUrl changes
This commit is contained in:
parent
71cce6730e
commit
5973ce4364
@ -1,13 +1,14 @@
|
||||
import type { User } from '$lib/backend/cloud';
|
||||
import type { GitHubIntegrationContext } from '$lib/github/types';
|
||||
import type { BaseBranch } from '$lib/vbranches/types';
|
||||
import { combineLatest, switchMap, type Observable, of, shareReplay } from 'rxjs';
|
||||
import { combineLatest, switchMap, type Observable, of, shareReplay, distinct } from 'rxjs';
|
||||
|
||||
export function getGithubContext(
|
||||
user$: Observable<User | undefined>,
|
||||
baseBranch$: Observable<BaseBranch | null>
|
||||
): Observable<GitHubIntegrationContext | undefined> {
|
||||
return combineLatest([user$, baseBranch$]).pipe(
|
||||
const distinctUrl$ = baseBranch$.pipe(distinct((ctx) => ctx?.remoteUrl));
|
||||
return combineLatest([user$, distinctUrl$]).pipe(
|
||||
switchMap(([user, baseBranch]) => {
|
||||
const remoteUrl = baseBranch?.remoteUrl;
|
||||
const authToken = user?.github_access_token;
|
||||
|
Loading…
Reference in New Issue
Block a user