From 5cbdc66e19808e0f6e8aee33109c86bba730ebb9 Mon Sep 17 00:00:00 2001 From: Marc Scholten Date: Tue, 28 Sep 2021 13:40:13 +0200 Subject: [PATCH] Fixed redirectTo not working in controllers where no view is imported This change adds a `import Web.Routes` to every freshly generated `Web.Controller.Prelude`. This ensures that the routing instances are in scope even when no view is imported. Without these instances being in scope, calls to redirectTo will fail. --- IHP/IDE/CodeGen/ApplicationGenerator.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/IHP/IDE/CodeGen/ApplicationGenerator.hs b/IHP/IDE/CodeGen/ApplicationGenerator.hs index d16547db3..6f1ac5238 100644 --- a/IHP/IDE/CodeGen/ApplicationGenerator.hs +++ b/IHP/IDE/CodeGen/ApplicationGenerator.hs @@ -60,6 +60,7 @@ generateGenericApplication applicationName = <> "import Application.Helper.Controller\n" <> "import IHP.ControllerPrelude\n" <> "import Generated.Types\n" + <> "import " <> applicationName <> ".Routes\n" viewLayoutHs = "module " <> applicationName <> ".View.Layout (defaultLayout, Html) where\n"