fix: optimize content script performance and reduce main thread blocking (#100) - #117
Conversation
…ing (#100) Reduces content script initialization overhead, defers non-critical work, and minimizes DOM interaction latency to improve page load performance. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a7ca674b99
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| history.pushState = function (...args: Parameters<typeof history.pushState>): void { | ||
| originalPushState(...args); | ||
| onUrlChange(); |
There was a problem hiding this comment.
Observe navigation from the page's execution world
Because public/manifest.json does not specify "world": "MAIN", this content script runs in Chrome's isolated world. Reassigning history.pushState and replaceState here therefore does not wrap the functions invoked by Salesforce's page scripts; moreover, those calls do not emit popstate. During ordinary Lightning SPA navigation, onUrlChange() consequently never runs and reportOrgDetection() is not repeated, unlike with the removed DOM observer. Inject a page-world hook that relays navigation events, or retain another observer visible to the content script.
Useful? React with 👍 / 👎.
Reduces content script initialization overhead, defers non-critical work, and minimizes DOM interaction latency to improve page load performance.
Closes #100
🤖 Generated with Claude Code