From cc0615c7d919bd4f8f6aef2ea29e76a9aec2963d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20B=C3=BCchele?= Date: Thu, 10 Jan 2019 03:48:19 -0800 Subject: [PATCH] Sort plugins by name Summary: Sort plugins in sidebar by name (or ID as fallback). Reviewed By: passy Differential Revision: D13621422 fbshipit-source-id: dd264bde64409a2cd81caa0b41af81bf614f9e62 --- src/chrome/MainSidebar.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/chrome/MainSidebar.js b/src/chrome/MainSidebar.js index d43be494f..540972b99 100644 --- a/src/chrome/MainSidebar.js +++ b/src/chrome/MainSidebar.js @@ -226,6 +226,9 @@ class MainSidebar extends PureComponent { ) .sort((a, b) => (a.query.app || '').localeCompare(b.query.app)); + const byPluginNameOrId = (a, b) => + (a.title || a.id) > (b.title || b.id) ? 1 : -1; + return ( { {selectedDevice && Array.from(this.props.devicePlugins.values()) .filter(plugin => plugin.supportsDevice(selectedDevice)) + .sort(byPluginNameOrId) .map((plugin: Class>) => ( { (p: Class>) => client.plugins.indexOf(p.id) > -1, ) + .sort(byPluginNameOrId) .map((plugin: Class>) => (