diff --git a/src/helper/childRegistrationUtils.js b/src/helper/childRegistrationUtils.js index 7b3cbb7..0a2aaac 100644 --- a/src/helper/childRegistrationUtils.js +++ b/src/helper/childRegistrationUtils.js @@ -233,7 +233,18 @@ class ChildRegistrationUtils { this.logger.warn("Invalid reactor provided."); return; } - this.mainClass.upstreamReactor = reactor; // Add reactor to the main class + + // this is poor code, it should be fixed at some point + if (this.mainClass?.upstreamReactor){ + this.mainClass.upstreamReactor = reactor; // Add reactor to the main class + } else { + if (positionVsParent == "downstream") { + this.mainClass.reactors[0] = reactor; + } + if (positionVsParent == "upstream") { + this.mainClass.reactors[1] = reactor; + } + } this.logger.info(`Reactor registered successfully.`); reactor.emitter.on("stateChange", (data) => {