observe expose with blocks variant id (#17482)
This commit is contained in:
@@ -577,7 +577,7 @@ export abstract class UmbBlockEntryContext<
|
||||
if (!variantId || !this.#contentKey) return;
|
||||
// TODO: Handle variantId changes
|
||||
this.observe(
|
||||
this._manager?.hasExposeOf(this.#contentKey),
|
||||
this._manager?.hasExposeOf(this.#contentKey, variantId),
|
||||
(hasExpose) => {
|
||||
this.#hasExpose.setValue(hasExpose);
|
||||
},
|
||||
|
||||
@@ -189,8 +189,7 @@ export abstract class UmbBlockManagerContext<
|
||||
);
|
||||
}
|
||||
|
||||
hasExposeOf(contentKey: string) {
|
||||
const variantId = this.#variantId.getValue();
|
||||
hasExposeOf(contentKey: string, variantId: UmbVariantId) {
|
||||
if (!variantId) return;
|
||||
return this.#exposes.asObservablePart((source) =>
|
||||
source.some((x) => x.contentKey === contentKey && variantId.compare(x)),
|
||||
|
||||
@@ -118,19 +118,19 @@ export class UmbBlockWorkspaceContext<LayoutDataType extends UmbBlockLayoutBaseM
|
||||
);
|
||||
|
||||
this.observe(
|
||||
this.contentKey,
|
||||
(contentKey) => {
|
||||
if (!contentKey) return;
|
||||
observeMultiple([this.contentKey, this.variantId]),
|
||||
([contentKey, variantId]) => {
|
||||
if (!contentKey || !variantId) return;
|
||||
|
||||
this.observe(
|
||||
manager.hasExposeOf(contentKey),
|
||||
manager.hasExposeOf(contentKey, variantId),
|
||||
(exposed) => {
|
||||
this.#exposed.setValue(exposed);
|
||||
},
|
||||
'observeHasExpose',
|
||||
);
|
||||
},
|
||||
'observeContentKey',
|
||||
'observeContentKeyAndVariantId',
|
||||
);
|
||||
}).asPromise();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user