diff --git a/change/@fluentui-web-components-80f9d773-bd90-490e-9d09-9a7c5518fa5b.json b/change/@fluentui-web-components-80f9d773-bd90-490e-9d09-9a7c5518fa5b.json new file mode 100644 index 0000000000000..efc499465938a --- /dev/null +++ b/change/@fluentui-web-components-80f9d773-bd90-490e-9d09-9a7c5518fa5b.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "(web-components) Fix issue loading Color Explorer values", + "packageName": "@fluentui/web-components", + "email": "47367562+bheston@users.noreply.github.com", + "dependentChangeType": "patch" +} diff --git a/packages/web-components/src/_docs/design-system/color-explorer/components/color-block.ts b/packages/web-components/src/_docs/design-system/color-explorer/components/color-block.ts index bee3210de59a9..a8bde30f0028d 100644 --- a/packages/web-components/src/_docs/design-system/color-explorer/components/color-block.ts +++ b/packages/web-components/src/_docs/design-system/color-explorer/components/color-block.ts @@ -424,16 +424,11 @@ export class AppColorBlock extends FASTElement { @attr color: string; private colorChanged(): void { - this.updateColor(); + DOM.queueUpdate(() => this.updateColor()); } @attr({ attribute: 'layer-name' }) layerName?: string; - public connectedCallback() { - super.connectedCallback(); - DOM.queueUpdate(() => this.updateColor()); - } - private updateColor(): void { if (this.color && this.$fastController.isConnected) { const color = parseColorHexRGB(this.color)!; diff --git a/packages/web-components/src/_docs/design-system/color-explorer/components/swatch.ts b/packages/web-components/src/_docs/design-system/color-explorer/components/swatch.ts index a05699a77919b..9d2cc6f895fd5 100644 --- a/packages/web-components/src/_docs/design-system/color-explorer/components/swatch.ts +++ b/packages/web-components/src/_docs/design-system/color-explorer/components/swatch.ts @@ -102,6 +102,17 @@ export class AppSwatch extends FoundationElement { public connectedCallback() { super.connectedCallback(); + const fillColorChangeHandler = () => { + this.updateObservables(); + }; + + fillColor.subscribe( + { + handleChange: fillColorChangeHandler, + }, + this, + ); + this.updateObservables(); }