Skip to content

Commit

Permalink
moved initFlashMessages to renderHtml function in Render module.
Browse files Browse the repository at this point in the history
  • Loading branch information
hllizi committed Aug 16, 2021
1 parent 161d575 commit f59abbf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
4 changes: 2 additions & 2 deletions IHP/Controller/Render.hs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import Text.Blaze.Html (Html)
import GHC.Records
import qualified IHP.Controller.Context as Context
import IHP.Controller.Layout
import IHP.FlashMessages.ControllerFunctions (initFlashMessages)

renderPlain :: (?context :: ControllerContext) => LByteString -> IO ()
renderPlain text = respondAndExit $ responseLBS status200 [(hContentType, "text/plain")] text
Expand All @@ -37,9 +38,8 @@ respondSvg html = respondAndExit $ responseBuilder status200 [(hContentType, "im
renderHtml :: forall viewContext view controller. (ViewSupport.View view, ?context :: ControllerContext, ?modelContext :: ModelContext) => view -> IO Html
renderHtml !view = do
let ?view = view

initFlashMessages
ViewSupport.beforeRender view

frozenContext <- Context.freeze ?context

let ?context = frozenContext
Expand Down
1 change: 0 additions & 1 deletion IHP/ControllerSupport.hs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ runActionWithNewContext controller = do
let ?context = controllerContext
Context.putContext ?application
Context.putContext (Context.ActionType (Typeable.typeOf controller))
initFlashMessages
Assets.initAssetVersion

try (initContext @application) >>= \case
Expand Down

0 comments on commit f59abbf

Please sign in to comment.