From f05db4b2918b58ee029131b674b8aee9efd741b6 Mon Sep 17 00:00:00 2001 From: yggverse Date: Tue, 16 Jul 2024 23:11:18 +0300 Subject: [PATCH] render page on connection completed only --- src/Entity/Browser/Container/Page.php | 66 +++++++++++++-------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/src/Entity/Browser/Container/Page.php b/src/Entity/Browser/Container/Page.php index cb218c4e..c35efd63 100644 --- a/src/Entity/Browser/Container/Page.php +++ b/src/Entity/Browser/Container/Page.php @@ -181,52 +181,52 @@ class Page return false; // stop } - // Update title - $this->title->set( - $connection->getTitle(), - $connection->getSubtitle(), - $connection->getTooltip() - ); - - // Update content - switch ($connection->getMime()) + // Stop event loop on request completed + if ($connection->isCompleted()) { - case 'text/gemini': + // Update title + $this->title->set( + $connection->getTitle(), + $connection->getSubtitle(), + $connection->getTooltip() + ); - $title = null; + // Update content + switch ($connection->getMime()) + { + case 'text/gemini': - $this->content->setGemtext( - (string) $connection->getData(), - $title - ); + $title = null; - if ($title) - { - $this->title->setValue( + $this->content->setGemtext( + (string) $connection->getData(), $title ); - } - break; + if ($title) + { + $this->title->setValue( + $title + ); + } - case 'text/plain': + break; - $this->content->setPlain( - (string) $connection->getData() - ); + case 'text/plain': - break; + $this->content->setPlain( + (string) $connection->getData() + ); - default: + break; - throw new \Exception( - _('MIME type not supported') - ); - } + default: + + throw new \Exception( + _('MIME type not supported') + ); + } - // Stop event loop on request completed - if ($connection->isCompleted()) - { // Hide progressbar $this->progressbar->hide();