mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 02:11:53 +00:00
Bugfix/marketplace add (#1805)
* remove falsey check when getting marketplaces, as no alts could exist * filter boolean but start with object Co-authored-by: Matt Hill <matthewonthemoon@gmail.com>
This commit is contained in:
@@ -37,8 +37,13 @@ export class MarketplaceService extends AbstractMarketplaceService {
|
||||
private readonly uiMarketplaceData$ = this.patch
|
||||
.watch$('ui', 'marketplace')
|
||||
.pipe(
|
||||
filter(Boolean),
|
||||
startWith({
|
||||
'selected-id': null,
|
||||
'known-hosts': {},
|
||||
}),
|
||||
distinctUntilChanged(
|
||||
(prev, curr) => prev?.['selected-id'] === curr?.['selected-id'],
|
||||
(prev, curr) => prev['selected-id'] === curr['selected-id'],
|
||||
),
|
||||
shareReplay(1),
|
||||
)
|
||||
@@ -280,8 +285,8 @@ export class MarketplaceService extends AbstractMarketplaceService {
|
||||
}
|
||||
}
|
||||
|
||||
private toMarketplace(marketplace?: UIMarketplaceData): Marketplace {
|
||||
return marketplace?.['selected-id']
|
||||
private toMarketplace(marketplace: UIMarketplaceData): Marketplace {
|
||||
return marketplace['selected-id']
|
||||
? marketplace['known-hosts'][marketplace['selected-id']]
|
||||
: this.config.marketplace
|
||||
}
|
||||
|
||||
@@ -3,10 +3,18 @@ import {
|
||||
DataModel,
|
||||
UIMarketplaceData,
|
||||
} from 'src/app/services/patch-db/data-model'
|
||||
import { filter, firstValueFrom } from 'rxjs'
|
||||
import { filter, firstValueFrom, startWith } from 'rxjs'
|
||||
|
||||
export function getMarketplace(
|
||||
patch: PatchDB<DataModel>,
|
||||
): Promise<UIMarketplaceData> {
|
||||
return firstValueFrom(patch.watch$('ui', 'marketplace').pipe(filter(Boolean)))
|
||||
return firstValueFrom(
|
||||
patch.watch$('ui', 'marketplace').pipe(
|
||||
filter(Boolean),
|
||||
startWith({
|
||||
'selected-id': null,
|
||||
'known-hosts': {},
|
||||
}),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user