From ea6e4ce079bc80acca5bdd045175f42a81992101 Mon Sep 17 00:00:00 2001 From: Zef Hemel Date: Sat, 3 Aug 2024 20:59:53 +0200 Subject: [PATCH] Emit config:loaded event --- common/config.ts | 3 +-- server/instance.ts | 1 + web/client.ts | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/common/config.ts b/common/config.ts index a2770b31..7141bf09 100644 --- a/common/config.ts +++ b/common/config.ts @@ -97,8 +97,7 @@ async function loadConfigsFromSystem( fullConfig = deepObjectMerge(fullConfig, { [config.key]: config.value }); } // And clean up the JSON (expand .-separated paths, convert dates to strings) - fullConfig = cleanupJSON(fullConfig); - return fullConfig; + return cleanupJSON(fullConfig); } /** diff --git a/server/instance.ts b/server/instance.ts index f3c8b997..1c7039b2 100644 --- a/server/instance.ts +++ b/server/instance.ts @@ -149,6 +149,7 @@ export class SpaceServer implements ConfigContainer { if (this.serverSystem) { updateObjectDecorators(this.config, this.serverSystem.ds); + this.serverSystem.eventHook.dispatchEvent("config:loaded", this.config); } } } diff --git a/web/client.ts b/web/client.ts index fd2166e0..783128a5 100644 --- a/web/client.ts +++ b/web/client.ts @@ -271,6 +271,7 @@ export class Client implements ConfigContainer { this.clientSystem.slashCommandHook.buildAllCommands( this.clientSystem.system, ); + this.eventHook.dispatchEvent("config:loaded", this.config); } private async initSync() {