fix: eliminate $_SESSION drift in SessionProvider and add notification UI states
Pass AppContainer to SessionProvider::clear() so all module providers use SessionStoreInterface consistently instead of raw $_SESSION. Also add loading and error states to the notification bell dropdown (GR-UI-014). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -13,15 +13,19 @@ final class NotificationsSessionProvider implements SessionProvider
|
||||
|
||||
public function populate(array $user, AppContainer $container): void
|
||||
{
|
||||
$userId = (int) ($user['id'] ?? 0);
|
||||
if ($userId <= 0) {
|
||||
unset($_SESSION[self::SESSION_KEY]);
|
||||
$sessionStore = $container->get(SessionStoreInterface::class);
|
||||
if (!$sessionStore instanceof SessionStoreInterface) {
|
||||
return;
|
||||
}
|
||||
|
||||
$userId = (int) ($user['id'] ?? 0);
|
||||
if ($userId <= 0) {
|
||||
$sessionStore->remove(self::SESSION_KEY);
|
||||
return;
|
||||
}
|
||||
|
||||
$sessionStore = $container->get(SessionStoreInterface::class);
|
||||
$service = $container->get(NotificationService::class);
|
||||
if (!$sessionStore instanceof SessionStoreInterface || !$service instanceof NotificationService) {
|
||||
if (!$service instanceof NotificationService) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -30,8 +34,11 @@ final class NotificationsSessionProvider implements SessionProvider
|
||||
$sessionStore->set(self::SESSION_KEY, $service->unreadCount($userId, $tenantId > 0 ? $tenantId : null));
|
||||
}
|
||||
|
||||
public function clear(): void
|
||||
public function clear(AppContainer $container): void
|
||||
{
|
||||
unset($_SESSION[self::SESSION_KEY]);
|
||||
$sessionStore = $container->get(SessionStoreInterface::class);
|
||||
if ($sessionStore instanceof SessionStoreInterface) {
|
||||
$sessionStore->remove(self::SESSION_KEY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user