Skip to content

Commit

Permalink
Don't use extra updates for http requests (#223)
Browse files Browse the repository at this point in the history
fixes #217
  • Loading branch information
yhabteab authored Nov 16, 2023
2 parents 7676092 + ae605d5 commit 320501a
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions application/controllers/ReportController.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,25 @@ public function indexAction()
$this->controls->getAttributes()->add('class', 'default-layout');
$this->addControl($this->assembleActions());

/** @var string $contentId */
$contentId = $this->content->getAttributes()->get('id')->getValue();
$this->sendExtraUpdates([
$contentId => Url::fromPath('reporting/report/content', ['id' => $this->report->getId()])
]);

// Will be replaced once the report content is rendered
$this->addContent(new HtmlElement('div'));
if ($this->isXhr()) {
/** @var string $contentId */
$contentId = $this->content->getAttributes()->get('id')->getValue();
$this->sendExtraUpdates([
$contentId => Url::fromPath('reporting/report/content', ['id' => $this->report->getId()])
]);

// Will be replaced once the report content is rendered
$this->addContent(new HtmlElement('div'));
} else {
Environment::raiseExecutionTime();
Environment::raiseMemoryLimit();

try {
$this->addContent($this->report->toHtml());
} catch (Exception $e) {
$this->addContent(Error::show($e));
}
}
}

public function contentAction(): void
Expand Down

0 comments on commit 320501a

Please sign in to comment.