From 2f70e524c33db55a3c33c0a4bb02eaee093d8454 Mon Sep 17 00:00:00 2001 From: Zander Brown Date: Fri, 2 Apr 2021 04:39:31 +0100 Subject: [PATCH] remoteSearch: Fetch enabled/disabled list once GLib should be caching the values but it seems unnecessary to fetch and marshal what should be the same lists N times instead of just once Part-of: --- js/ui/remoteSearch.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/js/ui/remoteSearch.js b/js/ui/remoteSearch.js index 77ad317e1..137516bdc 100644 --- a/js/ui/remoteSearch.js +++ b/js/ui/remoteSearch.js @@ -142,16 +142,16 @@ function loadRemoteSearchProviders(searchSettings, callback) { // Special case gnome-control-center to be always active and always first sortOrder.unshift('gnome-control-center.desktop'); + const disabled = searchSettings.get_strv('disabled'); + const enabled = searchSettings.get_strv('enabled'); + loadedProviders = loadedProviders.filter(provider => { let appId = provider.appInfo.get_id(); - if (provider.defaultEnabled) { - let disabled = searchSettings.get_strv('disabled'); + if (provider.defaultEnabled) return !disabled.includes(appId); - } else { - let enabled = searchSettings.get_strv('enabled'); + else return enabled.includes(appId); - } }); loadedProviders.sort((providerA, providerB) => {