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,23 +13,30 @@ final class BookmarksSessionProvider 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);
|
||||
$bookmarkService = $container->get(BookmarkService::class);
|
||||
if (!$sessionStore instanceof SessionStoreInterface || !$bookmarkService instanceof BookmarkService) {
|
||||
if (!$bookmarkService instanceof BookmarkService) {
|
||||
return;
|
||||
}
|
||||
|
||||
$sessionStore->set(self::SESSION_KEY, $bookmarkService->listGroupedForUser($userId));
|
||||
}
|
||||
|
||||
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