Skip to content

Commit

Permalink
Don't use extra updates for http requests
Browse files Browse the repository at this point in the history
  • Loading branch information
yhabteab committed Nov 16, 2023
1 parent 7676092 commit ae605d5
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 ae605d5

Please sign in to comment.