reloadFromSession(); } #[LiveListener('readingListUpdated')] public function refresh(): void { $this->reloadFromSession(); } #[LiveAction] public function remove(string $coordinate): void { $session = $this->requestStack->getSession(); $draft = $session->get('read_wizard'); if ($draft instanceof CategoryDraft) { $draft->articles = array_values(array_filter($draft->articles, fn($c) => $c !== $coordinate)); $session->set('read_wizard', $draft); $this->draft = $draft; } } private function reloadFromSession(): void { $session = $this->requestStack->getSession(); $data = $session->get('read_wizard'); if ($data instanceof CategoryDraft) { $this->draft = $data; if (!$this->draft->slug) { $this->draft->slug = substr(bin2hex(random_bytes(6)), 0, 8); $session->set('read_wizard', $this->draft); } return; } $this->draft = new CategoryDraft(); $this->draft->title = 'Reading List'; $this->draft->slug = substr(bin2hex(random_bytes(6)), 0, 8); $session->set('read_wizard', $this->draft); } }