@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Make panels decide async rendering nonrandomly

Summary: Ref T4986. The random rule was useful for making sure stuff works, but it works now.

Test Plan: Loaded some dashboards, got consistent async vs non-async.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T4986

Differential Revision: https://secure.phabricator.com/D9281

+33 -15
+23 -15
src/applications/dashboard/paneltype/PhabricatorDashboardPanelType.php
··· 7 7 abstract public function getPanelTypeDescription(); 8 8 abstract public function getFieldSpecifications(); 9 9 10 + abstract public function renderPanelContent( 11 + PhabricatorUser $viewer, 12 + PhabricatorDashboardPanel $panel, 13 + PhabricatorDashboardPanelRenderingEngine $engine); 14 + 15 + /** 16 + * Should this panel pull content in over AJAX? 17 + * 18 + * Normally, panels use AJAX to render their content. This makes the page 19 + * interactable sooner, allows panels to render in parallel, and prevents one 20 + * slow panel from slowing everything down. 21 + * 22 + * However, some panels are very cheap to build (i.e., no expensive service 23 + * calls or complicated rendering). In these cases overall performance can be 24 + * improved by disabling async rendering so the panel rendering happens in the 25 + * same process. 26 + * 27 + * @return bool True to enable asynchronous rendering when appropriate. 28 + */ 29 + public function shouldRenderAsync() { 30 + return true; 31 + } 32 + 10 33 public static function getAllPanelTypes() { 11 34 static $types; 12 35 ··· 38 61 } 39 62 40 63 return $types; 41 - } 42 - 43 - 44 - 45 - public function renderPanelContent( 46 - PhabricatorUser $viewer, 47 - PhabricatorDashboardPanel $panel, 48 - PhabricatorDashboardPanelRenderingEngine $engine) { 49 - return pht('TODO: Panel content goes here.'); 50 - } 51 - 52 - public function shouldRenderAsync() { 53 - // TODO: For now, just make these things random so we can catch anything 54 - // that breaks. 55 - return (mt_rand(0, 1) == 1); 56 64 } 57 65 58 66 }
+5
src/applications/dashboard/paneltype/PhabricatorDashboardPanelTypeTabs.php
··· 25 25 ); 26 26 } 27 27 28 + public function shouldRenderAsync() { 29 + // The actual tab panel itself is cheap to render. 30 + return false; 31 + } 32 + 28 33 public function renderPanelContent( 29 34 PhabricatorUser $viewer, 30 35 PhabricatorDashboardPanel $panel,
+5
src/applications/dashboard/paneltype/PhabricatorDashboardPanelTypeText.php
··· 26 26 ); 27 27 } 28 28 29 + public function shouldRenderAsync() { 30 + // Rendering text panels is normally a cheap cache hit. 31 + return false; 32 + } 33 + 29 34 public function renderPanelContent( 30 35 PhabricatorUser $viewer, 31 36 PhabricatorDashboardPanel $panel,