From 7d6ac00d6ee5e369bfd42f8f5f7c0042b7ab4e88 Mon Sep 17 00:00:00 2001 From: Daemon Date: Tue, 1 Oct 2024 17:12:37 -0500 Subject: [PATCH] Update init.luau fixes default lifecyle memory leak from overconnecting --- src/init.luau | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/init.luau b/src/init.luau index e5a7604..bf7d529 100644 --- a/src/init.luau +++ b/src/init.luau @@ -95,9 +95,6 @@ local function LoadControllersAsync(controllers: { Types.Controller }) for _, lifecycle in Lifecycles do if (controller :: any)[lifecycle.Name] then table.insert(lifecycle.Listeners, (controller :: any)[lifecycle.Name]) - if DefaultLifecycles[lifecycle.Name] then - LoadDefaultLifecycle(lifecycle) - end end end @@ -123,6 +120,13 @@ local function LoadControllersAsync(controllers: { Types.Controller }) LoadController(controller.Start, "Start") end end + + -- Connect default lifecycles + for _, lifecycle in Lifecycles do + if DefaultLifecycles[lifecycle.Name] then + LoadDefaultLifecycle(lifecycle) + end + end end -- Loads all of the provided directories