Skip to content

perf: make initial CSS and feature application happen earlier#1046

Open
txruno wants to merge 1 commit intoSTForScratch:mainfrom
txruno:improve-waitfor-elements
Open

perf: make initial CSS and feature application happen earlier#1046
txruno wants to merge 1 commit intoSTForScratch:mainfrom
txruno:improve-waitfor-elements

Conversation

@txruno
Copy link
Copy Markdown
Contributor

@txruno txruno commented Apr 5, 2026

Summary

This reduces the delay between page load and ScratchTools being applied by moving style injection and feature startup earlier in the load path, while keeping the feature logic itself unchanged.

Changes

  • Made CSS injection start immediately instead of waiting only for the next head mutation.
  • Made style retrieval from the background script resilient during startup so it can wait for cache readiness instead of returning too early.
  • Pre-warmed the cache on features changes and during tab loading to reduce first-load races.
  • Kept the changes limited to the injection and startup path, with no changes to individual feature implementations.

Verification

  • Checked on Windows 11 with Edge.
  • Reviewed with GPT-5.3-codex.

Resolves #939

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve ScratchTools.waitForElements

2 participants