Skip to content

Commit

Permalink
Fixed redirectTo not working in controllers where no view is imported
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mpscholten committed Sep 28, 2021
1 parent 70738b2 commit 5cbdc66
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions IHP/IDE/CodeGen/ApplicationGenerator.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 5cbdc66

Please sign in to comment.