From c88bdac4b1d9da89dcda74133045be776d73cfb3 Mon Sep 17 00:00:00 2001 From: Dan <12800016+rinslow@users.noreply.github.com> Date: Wed, 28 May 2025 16:08:05 +0300 Subject: [PATCH] fix(Customization): Fixed incorrect events broadcast (#5075) Co-authored-by: Dan Elkis --- .../CustomizationService/CustomizationService.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/platform/core/src/services/CustomizationService/CustomizationService.ts b/platform/core/src/services/CustomizationService/CustomizationService.ts index e8ffa6001..fd14b3bef 100644 --- a/platform/core/src/services/CustomizationService/CustomizationService.ts +++ b/platform/core/src/services/CustomizationService/CustomizationService.ts @@ -161,10 +161,11 @@ export default class CustomizationService extends PubSubService { * @param customizationId - The ID of the customization to retrieve. * @param scope - (Optional) The scope to retrieve from: 'global', 'mode', or 'default'. * If not specified, it retrieves based on priority: global > mode > default. - * @returns The requested customization. + * @returns The requested customization, or undefined if not found */ - public getCustomization(customizationId: string): Customization { + public getCustomization(customizationId: string): Customization | undefined { const transformed = this.transformedCustomizations.get(customizationId); + if (transformed) { return transformed; } @@ -320,7 +321,7 @@ export default class CustomizationService extends PubSubService { this.modeCustomizations.set(customizationId, result); this.transformedCustomizations.clear(); - this._broadcastEvent(this.EVENTS.CUSTOMIZATION_MODIFIED, { + this._broadcastEvent(this.EVENTS.MODE_CUSTOMIZATION_MODIFIED, { buttons: this.modeCustomizations, button: this.modeCustomizations.get(customizationId), }); @@ -334,7 +335,7 @@ export default class CustomizationService extends PubSubService { this.globalCustomizations.set(id, this._update(sourceCustomization, value)); this.transformedCustomizations.clear(); - this._broadcastEvent(this.EVENTS.DEFAULT_CUSTOMIZATION_MODIFIED, { + this._broadcastEvent(this.EVENTS.GLOBAL_CUSTOMIZATION_MODIFIED, { buttons: this.defaultCustomizations, button: this.defaultCustomizations.get(id), });