boostercloud / booster

Booster Framework
https://www.boosterframework.com
Apache License 2.0
416 stars 86 forks source link

Event Constructor Logic Not Being Invoked on Object Instantiation #1462

Open javiertoledo opened 12 months ago

javiertoledo commented 12 months ago

Bug Report

Current Behavior

When implementing logic within the constructor of an event in the Booster Framework, the constructor code is not being invoked as expected. The constructor logic has to be moved to a static method which is then explicitly called to ensure proper execution.

Expected behavior

It is expected that the constructor code within an event should be invoked properly, ensuring that any logic within the constructor executes as intended without the need to relocate the logic to a static method.

Possible Solution

It appears that the issue might be stemming from how the event dispatcher is handling object instantiation -- specifically, passing plain JSON received from the DB and instructing TypeScript to treat it as a class instance. A potential solution could involve revising the instantiation process to ensure that constructors are called and executed properly.

Additional information

Environment

Comments

This issue was brought to attention by users experiencing unpredictable behavior due to constructor logic not executing. An investigation into the event dispatcher's object instantiation process might provide insight into resolving this bug.