Page MenuHomePhabricator
Paste P2014

Search Double
ActivePublic

Authored by chad on Oct 15 2016, 4:21 AM.
<?php
final class ConpherenceThreadSearchController
extends ConpherenceController {
public function shouldAllowPublic() {
return true;
}
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();
$conpherence_id = $request->getURIData('id');
$fulltext = $request->getStr('fulltext');
$conpherence = id(new ConpherenceThreadQuery())
->setViewer($viewer)
->withIDs(array($conpherence_id))
->executeOne();
if (!$conpherence) {
return new Aphront404Response();
}
$engine = new ConpherenceThreadSearchEngine();
$engine->setViewer($viewer);
$saved = $engine->buildSavedQueryFromBuiltin('all')
->setParameter('phids', array($conpherence->getPHID()))
->setParameter('fulltext', $fulltext);
$pager = $engine->newPagerForSavedQuery($saved);
$pager->setPageSize(15);
$query = $engine->buildQueryFromSavedQuery($saved);
$results = $engine->executeQuery($query, $pager);
$view = $engine->renderResults($results, $saved);
$content = $view->getContent();
$content->render();
return $this->newPage()
->appendChild($content);
}
}

Event Timeline

chad created this paste.Oct 15 2016, 4:21 AM

This page renders transactions twice, by example, at line 39. Nothing else renders twice. I poked around AphrontAjaxResponse and nothing looked hokey, but I can't really figure this out. The double transactions appear to come from multiple render calls somewhere in AphrontAjaxResponse?

chad added a comment.Oct 15 2016, 4:33 AM

yay I found the double render

chad added a comment.Oct 15 2016, 4:33 AM

probably still a bug somewhere else tho, but i solved my problemo