From 874376bbedc0591e4201ad93cb917e5141d06133 Mon Sep 17 00:00:00 2001 From: yggverse Date: Fri, 19 Jul 2024 12:46:06 +0300 Subject: [PATCH] update session on request update --- .../Browser/Container/Page/Navbar/Request.php | 4 +++ src/Entity/Browser/Container/Tab.php | 27 ++++++++++++------- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/src/Entity/Browser/Container/Page/Navbar/Request.php b/src/Entity/Browser/Container/Page/Navbar/Request.php index 04d6e657..38b580db 100644 --- a/src/Entity/Browser/Container/Page/Navbar/Request.php +++ b/src/Entity/Browser/Container/Page/Navbar/Request.php @@ -15,6 +15,8 @@ class Request extends \Yggverse\Yoda\Abstract\Entity\Browser\Container\Page\Navb $this->navbar->page->open( $entry->get_text() ); + + $this->navbar->page->container->tab->updateSession(); // @TODO async page update } protected function _onKeyRelease( @@ -23,5 +25,7 @@ class Request extends \Yggverse\Yoda\Abstract\Entity\Browser\Container\Page\Navb ): void { $this->navbar->refresh(); + + $this->navbar->page->container->tab->updateSession(); } } \ No newline at end of file diff --git a/src/Entity/Browser/Container/Tab.php b/src/Entity/Browser/Container/Tab.php index 0460dadd..3c2f94e5 100644 --- a/src/Entity/Browser/Container/Tab.php +++ b/src/Entity/Browser/Container/Tab.php @@ -219,19 +219,14 @@ class Tab // Reorder entities $this->_page = $_page; + ksort( + $this->_page + ); + // Update session if ($session) { - $this->container->browser->database->cleanSession(); - - ksort($_page); - - foreach ($_page as $page) - { - $this->container->browser->database->addSession( - $page->navbar->request->getValue() - ); - } + $this->updateSession(); } } @@ -240,4 +235,16 @@ class Tab 'Reorder by $page_num value not implemented' ); } + + public function updateSession(): void + { + $this->container->browser->database->cleanSession(); + + foreach ($this->_page as $page) + { + $this->container->browser->database->addSession( + $page->navbar->request->getValue() + ); + } + } } \ No newline at end of file