fix(flash): make flash messages one-shot per request

This commit is contained in:
2026-04-15 18:45:45 +02:00
parent 63be2def76
commit 57b7920098
7 changed files with 149 additions and 20 deletions

View File

@@ -318,6 +318,17 @@ if (Router::getTemplateView()) {
);
}
if (!$isApiRequest) {
// Flash messages are consumed before Session::end() so one-shot removal
// is persisted even though views are rendered afterwards.
$flashScopes = [];
$pathScope = Request::path();
$pathWithQueryScope = Request::pathWithQuery();
$flashScopes[$pathScope] = true;
$flashScopes[$pathWithQueryScope] = true;
$appFlashMessages = flashConsumeForScopes(array_keys($flashScopes));
}
// ── 12. Session & DB close ──────────────────────────────────────────
Session::end();