mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-31 04:23:40 +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
|
private readonly uiMarketplaceData$ = this.patch
|
||||||
.watch$('ui', 'marketplace')
|
.watch$('ui', 'marketplace')
|
||||||
.pipe(
|
.pipe(
|
||||||
|
filter(Boolean),
|
||||||
|
startWith({
|
||||||
|
'selected-id': null,
|
||||||
|
'known-hosts': {},
|
||||||
|
}),
|
||||||
distinctUntilChanged(
|
distinctUntilChanged(
|
||||||
(prev, curr) => prev?.['selected-id'] === curr?.['selected-id'],
|
(prev, curr) => prev['selected-id'] === curr['selected-id'],
|
||||||
),
|
),
|
||||||
shareReplay(1),
|
shareReplay(1),
|
||||||
)
|
)
|
||||||
@@ -280,8 +285,8 @@ export class MarketplaceService extends AbstractMarketplaceService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private toMarketplace(marketplace?: UIMarketplaceData): Marketplace {
|
private toMarketplace(marketplace: UIMarketplaceData): Marketplace {
|
||||||
return marketplace?.['selected-id']
|
return marketplace['selected-id']
|
||||||
? marketplace['known-hosts'][marketplace['selected-id']]
|
? marketplace['known-hosts'][marketplace['selected-id']]
|
||||||
: this.config.marketplace
|
: this.config.marketplace
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,10 +3,18 @@ import {
|
|||||||
DataModel,
|
DataModel,
|
||||||
UIMarketplaceData,
|
UIMarketplaceData,
|
||||||
} from 'src/app/services/patch-db/data-model'
|
} from 'src/app/services/patch-db/data-model'
|
||||||
import { filter, firstValueFrom } from 'rxjs'
|
import { filter, firstValueFrom, startWith } from 'rxjs'
|
||||||
|
|
||||||
export function getMarketplace(
|
export function getMarketplace(
|
||||||
patch: PatchDB<DataModel>,
|
patch: PatchDB<DataModel>,
|
||||||
): Promise<UIMarketplaceData> {
|
): 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