feat: add tentative "CC slowness fix" feature
This is an urgent addition to help fix a CC issue.
Related to
https://groups.google.com/g/twpowertools-discuss/c/RUr7249IBuQ.
Change-Id: I3d40b70fb71b31f0b47c5f04ee20f440e49f2029
diff --git a/src/common/optionsPrototype.ts b/src/common/optionsPrototype.ts
index 58ad899..620158b 100644
--- a/src/common/optionsPrototype.ts
+++ b/src/common/optionsPrototype.ts
@@ -163,6 +163,11 @@
context: "options",
killSwitchType: "option",
},
+ fixpekb269560789: {
+ defaultValue: true,
+ context: "options",
+ killSwitchType: "option",
+ },
// Experiments:
workflows: {
diff --git a/src/contentScripts/communityConsole/start.js b/src/contentScripts/communityConsole/start.js
index a0640ba..c4a3d74 100644
--- a/src/contentScripts/communityConsole/start.js
+++ b/src/contentScripts/communityConsole/start.js
@@ -11,9 +11,15 @@
getOptions(null).then(options => {
/* IMPORTANT NOTE: Remember to change this when changing the "ifs" below!! */
if (options.loaddrafts || options.interopthreadpage ||
- options.nestedreplies) {
+ options.nestedreplies || options.fixpekb269560789) {
var startup =
- JSON.parse(document.querySelector('html').getAttribute('data-startup'));
+ JSON.parse(document.querySelector('html').getAttribute('data-startup'));
+
+ if (options.fixpekb269560789) {
+ if (startup[1]?.[1]?.[8]?.[7]) {
+ delete startup[1]?.[1]?.[8]?.[7];
+ }
+ }
if (options.loaddrafts) {
startup[4][13] = true;
diff --git a/src/options/optionsPage.json5 b/src/options/optionsPage.json5
index 9435ece..92a554f 100644
--- a/src/options/optionsPage.json5
+++ b/src/options/optionsPage.json5
@@ -6,6 +6,7 @@
{
name: 'featuredoptions',
options: [
+ {codename: 'fixpekb269560789'},
{codename: 'list'},
{codename: 'thread'},
{codename: 'threadall'},
diff --git a/src/static/_locales/en/messages.json b/src/static/_locales/en/messages.json
index 27f893a..0270096 100644
--- a/src/static/_locales/en/messages.json
+++ b/src/static/_locales/en/messages.json
@@ -183,6 +183,10 @@
"message": "Show a toggle to enable/disable nested view in threads.",
"description": "Feature checkbox in the options page"
},
+ "options_fixpekb269560789": {
+ "message": "Tentative fix for CC slowness and high memory usage (<a href='https://s.iavm.xyz/cc-running-slow-pekb'><code>pekb/269560789</code></a>).",
+ "description": "Feature checkbox in the options page"
+ },
"options_save": {
"message": "Save",
"description": "Button in the options page to save the settings"