summaryrefslogtreecommitdiff
path: root/source/features/index.tsx
diff options
context:
space:
mode:
authorGravatar Florent <cheap.glitch@gmail.com> 2021-04-08 10:45:57 +0200
committerGravatar GitHub <noreply@github.com> 2021-04-08 15:45:57 +0700
commit0ac8f8ceec6127788a233cbb41c8ee7c459ffaa7 (patch)
treef850d33f3ea19bb2effee27a9456746b34031b6e /source/features/index.tsx
parent7882e292ee0eec130b542e017d918ab7f06555be (diff)
downloadrefined-github-0ac8f8ceec6127788a233cbb41c8ee7c459ffaa7.tar.gz
refined-github-0ac8f8ceec6127788a233cbb41c8ee7c459ffaa7.tar.zst
refined-github-0ac8f8ceec6127788a233cbb41c8ee7c459ffaa7.zip
Help users find a feature with an interactive binary search (#4119)
Co-authored-by: Federico <me@fregante.com>
Diffstat (limited to 'source/features/index.tsx')
-rw-r--r--source/features/index.tsx20
1 files changed, 14 insertions, 6 deletions
diff --git a/source/features/index.tsx b/source/features/index.tsx
index 512eb18a..139e09f3 100644
--- a/source/features/index.tsx
+++ b/source/features/index.tsx
@@ -9,6 +9,7 @@ import compareVersions from 'tiny-version-compare';
import * as pageDetect from 'github-url-detection';
import onNewComments from '../github-events/on-new-comments';
+import bisectFeatures from '../helpers/bisect';
import optionsStorage, {RGHOptions} from '../options-storage';
type BooleanFunction = () => boolean;
@@ -93,12 +94,19 @@ const globalReady: Promise<RGHOptions> = new Promise(async resolve => {
document.documentElement.classList.add('refined-github');
// Options defaults
- const options = await optionsStorage.getAll();
- const hotfix = browser.runtime.getManifest().version === '0.0.0' || await cache.get('hotfix'); // Ignores the cache when loaded locally
-
- // If features are remotely marked as "seriously breaking" by the maintainers, disable them without having to wait for proper updates to propagate #3529
- void checkForHotfixes();
- Object.assign(options, hotfix);
+ const [options, hotfix, bisectedFeatures] = await Promise.all([
+ optionsStorage.getAll(),
+ browser.runtime.getManifest().version === '0.0.0' || await cache.get('hotfix'), // Ignores the cache when loaded locally
+ bisectFeatures()
+ ]);
+
+ if (bisectedFeatures) {
+ Object.assign(options, bisectedFeatures);
+ } else {
+ // If features are remotely marked as "seriously breaking" by the maintainers, disable them without having to wait for proper updates to propagate #3529
+ void checkForHotfixes();
+ Object.assign(options, hotfix);
+ }
if (options.customCSS.trim().length > 0) {
document.head.append(<style>{options.customCSS}</style>);