Skip to content

Commit

Permalink
Completely disable 4 slow features in Firefox/Safari (#7330)
Browse files Browse the repository at this point in the history
  • Loading branch information
Seregy committed Apr 9, 2024
1 parent f8ea50b commit 1996380
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 22 deletions.
5 changes: 2 additions & 3 deletions source/features/locked-issue.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import './locked-issue.css';
import React from 'react';
import LockIcon from 'octicons-plain-react/Lock';
import * as pageDetect from 'github-url-detection';
import {isChrome} from 'webext-detect-page';

import features from '../feature-manager.js';
import observe from '../helpers/selector-observer.js';
import {isHasSelectorSupported} from '../helpers/select-has.js';
import isBadBrowserOnPrFiles from '../helpers/7116.js';

function LockedIndicator(): JSX.Element {
return (
Expand Down Expand Up @@ -39,6 +39,7 @@ function init(signal: AbortSignal): void {
void features.add(import.meta.url, {
asLongAs: [
isHasSelectorSupported,
isChrome,
],
include: [
pageDetect.isConversation,
Expand All @@ -47,8 +48,6 @@ void features.add(import.meta.url, {
// TODO: Find alternative detection that works even for GHE that don't have reactions enabled
// https://github.com/refined-github/refined-github/issues/7063
pageDetect.isEnterprise,

isBadBrowserOnPrFiles,
],
init,
});
Expand Down
8 changes: 4 additions & 4 deletions source/features/quick-comment-edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import React from 'dom-chef';
import {elementExists} from 'select-dom';
import PencilIcon from 'octicons-plain-react/Pencil';
import * as pageDetect from 'github-url-detection';
import {isChrome} from 'webext-detect-page';

import observe from '../helpers/selector-observer.js';
import features from '../feature-manager.js';
import {isArchivedRepoAsync} from '../github-helpers/index.js';
import isBadBrowserOnPrFiles from '../helpers/7116.js';

function addQuickEditButton(commentForm: Element): void {
const commentBody = commentForm.closest('.js-comment')!;
Expand Down Expand Up @@ -58,12 +58,12 @@ async function init(signal: AbortSignal): Promise<void> {
}

void features.add(import.meta.url, {
asLongAs: [
isChrome,
],
include: [
pageDetect.hasComments,
],
exclude: [
isBadBrowserOnPrFiles,
],
// The feature is "disabled" via CSS selector when the conversation is locked.
// We want the edit buttons to appear while the conversation is loading, but we only know it's locked when the page has finished.
init,
Expand Down
8 changes: 4 additions & 4 deletions source/features/quick-review-comment-deletion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import {$} from 'select-dom';
import TrashIcon from 'octicons-plain-react/Trash';
import * as pageDetect from 'github-url-detection';
import delegate, {DelegateEvent} from 'delegate-it';
import {isChrome} from 'webext-detect-page';

import features from '../feature-manager.js';
import observe from '../helpers/selector-observer.js';
import loadDetailsMenu from '../github-helpers/load-details-menu.js';
import showToast from '../github-helpers/toast.js';
import isBadBrowserOnPrFiles from '../helpers/7116.js';

function onButtonClick({delegateTarget: button}: DelegateEvent): void {
try {
Expand Down Expand Up @@ -42,12 +42,12 @@ function init(signal: AbortSignal): void {
}

void features.add(import.meta.url, {
asLongAs: [
isChrome,
],
include: [
pageDetect.isPRConversation,
pageDetect.isPRFiles,
],
exclude: [
isBadBrowserOnPrFiles,
],
init,
});
8 changes: 4 additions & 4 deletions source/features/show-whitespace.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import './show-whitespace.css';
import * as pageDetect from 'github-url-detection';
import {isChrome} from 'webext-detect-page';

import features from '../feature-manager.js';
import {codeElementsSelector} from '../github-helpers/dom-formatters.js';
import showWhiteSpacesOnLine from '../helpers/show-whitespace-on-line.js';
import onAbort from '../helpers/abort-controller.js';
import observe from '../helpers/selector-observer.js';
import isBadBrowserOnPrFiles from '../helpers/7116.js';

const viewportObserver = new IntersectionObserver(changes => {
for (const {target: line, isIntersecting} of changes) {
Expand All @@ -28,12 +28,12 @@ function init(signal: AbortSignal): void {
}

void features.add(import.meta.url, {
asLongAs: [
isChrome,
],
include: [
pageDetect.hasCode,
],
exclude: [
isBadBrowserOnPrFiles,
],
init,
});

Expand Down
7 changes: 0 additions & 7 deletions source/helpers/7116.tsx

This file was deleted.

0 comments on commit 1996380

Please sign in to comment.