diff --git a/src/masonite/middleware/route/SessionMiddleware.py b/src/masonite/middleware/route/SessionMiddleware.py index 8d9a0b41..5a1103bf 100644 --- a/src/masonite/middleware/route/SessionMiddleware.py +++ b/src/masonite/middleware/route/SessionMiddleware.py @@ -17,7 +17,11 @@ def before(self, request, response): request.app.make("request").session = Session # TODO: Remove in Masonite 5 - request.app.make("view").share({"bag": MessageBag(Session.get("errors") or {}).helper}) + bag = MessageBag(Session.get("errors") or {}) + request.app.make("view").share({"errors": bag.helper}) + # errors are stored in session flash so 'getting' them actually clears them + # so re-add them to the session as a MessageBag + Session.flash('errors', bag) return request def after(self, request, _):