-
-
Notifications
You must be signed in to change notification settings - Fork 344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: flash messages were not displayed on Redirect #3420
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3420 +/- ##
=======================================
Coverage 98.29% 98.29%
=======================================
Files 328 328
Lines 14857 14864 +7
Branches 2356 2358 +2
=======================================
+ Hits 14603 14610 +7
Misses 116 116
Partials 138 138 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the flash config's reference to the session config necessary? I.e., can we check for a session middleware instead?
Also, I understand that current behavior is broken WRT to redirects, but should we try to make this change in a more backward compatible manner? I.e., if a session middleware is not found, fall back to the current implementation and include a deprecation warning that a session middleware will be required in a future version.
Improve search for session middleware by also looking for `MiddlewareWrapper`. It adds `SessionMiddleware` within itself if it is present.
…5_use_session_flash
Quality Gate passedIssues Measures |
Documentation preview will be available shortly at https://litestar-org.github.io/litestar-docs-preview/3420 |
* fix: Redirect on flash messages were not displayed * Update litestar/plugins/flash.py Co-authored-by: Peter Schutt <peter.github@proton.me> * nit * checking for SessionMiddleware breaks tests ? * using context vars passes the tests which reveals tests are incorrect... * Revert "using context vars passes the tests which reveals tests are incorrect..." This reverts commit fd55270. * Revert "checking for SessionMiddleware breaks tests ?" This reverts commit bbf6236. * check config differently in app_init * Removed the session_config from the plugin config * Fix mypy weirdness: see explanation in https://mypy.readthedocs.io/en/stable/type_narrowing.html#issubclass * cant fix mypy * fix: use `is_class_and_subclass()` for mw check. * Added test for better coverage on middleware type switch * Add check for `session_auth.middleware.MiddlewareWrapper` Improve search for session middleware by also looking for `MiddlewareWrapper`. It adds `SessionMiddleware` within itself if it is present. --------- Co-authored-by: Peter Schutt <peter.github@proton.me> (cherry picked from commit c625ce7)
* fix: Redirect on flash messages were not displayed * Update litestar/plugins/flash.py Co-authored-by: Peter Schutt <peter.github@proton.me> * nit * checking for SessionMiddleware breaks tests ? * using context vars passes the tests which reveals tests are incorrect... * Revert "using context vars passes the tests which reveals tests are incorrect..." This reverts commit fd55270. * Revert "checking for SessionMiddleware breaks tests ?" This reverts commit bbf6236. * check config differently in app_init * Removed the session_config from the plugin config * Fix mypy weirdness: see explanation in https://mypy.readthedocs.io/en/stable/type_narrowing.html#issubclass * cant fix mypy * fix: use `is_class_and_subclass()` for mw check. * Added test for better coverage on middleware type switch * Add check for `session_auth.middleware.MiddlewareWrapper` Improve search for session middleware by also looking for `MiddlewareWrapper`. It adds `SessionMiddleware` within itself if it is present. --------- Co-authored-by: Peter Schutt <peter.github@proton.me> (cherry picked from commit c625ce7)
Description
Closes