soscripted / sox

Stack Overflow Extras: a userscript for the Stack Exchange websites to add a bunch of optional toggle-able features
http://stackapps.com/q/6091/
MIT License
72 stars 15 forks source link

Staging Ground, Edit Question: freezes tab for a few seconds on load #510

Closed crackwitz closed 2 months ago

crackwitz commented 2 months ago

Describe the bug SO recently got a "Staging Ground". If you try to edit a question that is in the staging ground, SOX causes the page to freeze for several seconds as it builds the rich editor. Disabling SOX stops the issue.

To Reproduce Steps to reproduce the behaviour:

  1. Go to https://stackoverflow.com/staging-ground/
  2. Pick any question, scroll down to the "Edit" action on the left edge, click that
  3. Observe page loading and then lock up for a few seconds as the rich editor builds

SOX errors logged in console

SOX: logging sox stored values --- 
userscript.html?name=Stack-Overflow-Extras-SOX.user.js&id=01210d23-bf2a-430b-ab67-11d264c6a0e1:293 SOX: access token set
userscript.html?name=Stack-Overflow-Extras-SOX.user.js&id=01210d23-bf2a-430b-ab67-11d264c6a0e1:293 SOX: SOX-lastVersionInstalled
userscript.html?name=Stack-Overflow-Extras-SOX.user.js&id=01210d23-bf2a-430b-ab67-11d264c6a0e1:293 SOX: 2.8.0
userscript.html?name=Stack-Overflow-Extras-SOX.user.js&id=01210d23-bf2a-430b-ab67-11d264c6a0e1:293 SOX: SOXSETTINGS
userscript.html?name=Stack-Overflow-Extras-SOX.user.js&id=01210d23-bf2a-430b-ab67-11d264c6a0e1:293 SOX: ["Appearance-colorAnswerer","Appearance-displayName","Appearance-dragBounty","Appearance-highlightQuestions","Appearance-localTimestamps","Appearance-metaChatBlogStackExchangeButton","Appearance-scrollToTop","Appearance-tabularReviewerStats","Appearance-topAnswers","Appearance-unspoil","Appearance-addTimelineAndRevisionLinks","Appearance-showTagWikiLinkOnTagPopup","Appearance-hideWelcomeBackMessage","Appearance-openImagesAsModals","Appearance-addAnswerCountToQuestionHeader","Comments-autoShowCommentImages","Comments-commentReplies","Comments-commentShortcuts","Comments-confirmNavigateAway","Comments-copyCommentsLink","Comments-moveBounty","Comments-hiddenCommentsIndicator","Comments-onlyShowCommentActionsOnHover","Editing-addSBSBtn","Editing-editComment","Editing-findAndReplace","Editing-kbdAndBullets","Editing-inlineEditorEverywhere","Flags-flagOutcomeTime","Flags-flagPercentages","Flags-flagPercentageBar","Sidebar-hideCommunityBulletin","Sidebar-hideJustHotMetaPosts","Sidebar-hideHireMe","Sidebar-hideChatSidebar","Sidebar-hideLoveThisSite","Chat-chatEasyAccess","Chat-replyToOwnChatMessages","Chat-renameChat","Chat-scrollChatRoomsList","Voting-stickyVoteButtons","Voting-disableVoteButtons","Extras-shareLinksPrivacy","Extras-shareLinksMarkdown","Extras-sortByBountyAmount","Extras-warnNotLoggedIn","Extras-hideCertainQuestions","Extras-showMetaReviewCount","Extras-copyCode","Extras-openLinksInNewTab","Extras-addOnTopicLinkToSiteSwitcher","Extras-customMagicLinks"]
userscript.html?name=Stack-Overflow-Extras-SOX.user.js&id=01210d23-bf2a-430b-ab67-11d264c6a0e1:293 SOX: SOX-debug
userscript.html?name=Stack-Overflow-Extras-SOX.user.js&id=01210d23-bf2a-430b-ab67-11d264c6a0e1:293 SOX: true
userscript.html?name=Stack-Overflow-Extras-SOX.user.js&id=01210d23-bf2a-430b-ab67-11d264c6a0e1:287 SOX: There was an error loading the feature "Sidebar-hideCommunityBulletin". Please raise an issue on GitHub, and copy the following error log:
TypeError: Cannot read properties of null (reading 'remove')
sox.error @ userscript.html?name=Stack-Overflow-Extras-SOX.user.js&id=01210d23-bf2a-430b-ab67-11d264c6a0e1:287
runFeatures @ userscript.html?name=Stack-Overflow-Extras-SOX.user.js&id=01210d23-bf2a-430b-ab67-11d264c6a0e1:4030
window.addEventListener.once @ userscript.html?name=Stack-Overflow-Extras-SOX.user.js&id=01210d23-bf2a-430b-ab67-11d264c6a0e1:4094
wt @ VM320:9
n @ VM320:68

Expected behaviour

Page loads and renders within a second.

Screenshots/GIFs

while frozen:

image

eventually:

image

Environment

shu8 commented 2 months ago

Thanks for the bug report! I will look into this as soon as I can -- please could you dump the list of enabled features you have here, so we can try to figure out which feature is causing the issue? (or if you already know which feature it is, that would be great!)

crackwitz commented 2 months ago

I guess this might be what you're asking for... and it's not any of the six Editing- options. not that I see a difference.

[
  "Appearance-addAuthorNameToInboxNotifications",
  "Appearance-answerTagsSearch",
  "Appearance-colorAnswerer",
  "Appearance-dragBounty",
  "Appearance-highlightQuestions",
  "Appearance-isQuestionHot",
  "Appearance-localTimestamps",
  "Appearance-metaChatBlogStackExchangeButton",
  "Appearance-metaNewQuestionAlert",
  "Appearance-scrollToTop",
  "Appearance-standOutDupeCloseMigrated",
  "Appearance-tabularReviewerStats",
  "Appearance-unspoil",
  "Appearance-showTagWikiLinkOnTagPopup",
  "Appearance-hideWelcomeBackMessage",
  "Appearance-openImagesAsModals",
  "Appearance-addAnswerCountToQuestionHeader",
  "Comments-autoShowCommentImages",
  "Comments-commentReplies",
  "Comments-commentShortcuts",
  "Comments-confirmNavigateAway",
  "Comments-copyCommentsLink",
  "Comments-moveBounty",
  "Comments-showCommentScores",
  "Comments-hiddenCommentsIndicator",
  "Comments-onlyShowCommentActionsOnHover",
  "Editing-addSBSBtn",
  "Editing-editComment",
  "Editing-editReasonTooltip",
  "Editing-findAndReplace",
  "Editing-kbdAndBullets",
  "Editing-inlineEditorEverywhere",
  "Flags-flagOutcomeTime",
  "Flags-flagPercentages",
  "Flags-flagPercentageBar",
  "Sidebar-hideHireMe",
  "Sidebar-hideLoveThisSite",
  "Sidebar-linkedToFrom",
  "Sidebar-hotNetworkQuestionsFiltering",
  "Sidebar-addTagsToHNQs",
  "Chat-chatEasyAccess",
  "Chat-replyToOwnChatMessages",
  "Chat-renameChat",
  "Chat-scrollChatRoomsList",
  "Voting-betterCSS",
  "Voting-stickyVoteButtons",
  "Voting-disableVoteButtons",
  "Extras-linkedPostsInline",
  "Extras-parseCrossSiteLinks",
  "Extras-quickAuthorInfo",
  "Extras-shareLinksPrivacy",
  "Extras-shareLinksMarkdown",
  "Extras-sortByBountyAmount",
  "Extras-warnNotLoggedIn",
  "Extras-hideCertainQuestions",
  "Extras-showMetaReviewCount",
  "Extras-copyCode",
  "Extras-openLinksInNewTab",
  "Extras-addOnTopicLinkToSiteSwitcher",
  "Extras-customMagicLinks"
]
shu8 commented 2 months ago

@crackwitz please could you try the latest dev version v2.8.12 to see if this issue is now resolved?

crackwitz commented 2 months ago

Much improved! Performance profiling in Chrome shows very little difference now. I can tell a a little delay as the page loads but that's from SOX itself loading.

shu8 commented 2 months ago

@crackwitz That's great, thanks for confirming.

Yeah, SOX definitely does impact the page performance a bit - there's been a lot of effort to improve it in past years, but there's definitely more scope for improvement 😊

BTW - I pushed a few more patch versions in the last few minutes - v2.8.13 should be the 'latest' (can reinstall via the same link)!

crackwitz commented 2 months ago

With this dev version, I just noticed page freezes on regular question pages. That means the page takes longer to finish loading AND then the mouse cursor stops being sensitive to links and other entities. I don't know why that would happen. It's currently the only userscript enabled for the site. I did notice that there's an "api cache" field in the script's storage that is huge and doesn't even display properly. I tried deleting that. It didn't improve the situation.

shu8 commented 2 months ago

@crackwitz - just to confirm, is that in v2.8.13 too? (I tweaked some selectors since my original comment)

crackwitz commented 2 months ago

I used the provided URL (to dev). the script calls itself // @version 2.8.11 DEV

I just downgraded to https://github.com/soscripted/sox/raw/master/sox.user.js for now

shu8 commented 2 months ago

@crackwitz could you reinstall to v2.8.13: https://github.com/soscripted/sox/raw/dev/sox.user.js and see if it still happens?