-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#4190: Fix content script readiness race conditions and context invalidation handling #4240
Conversation
Codecov Report
@@ Coverage Diff @@
## main #4240 +/- ##
==========================================
- Coverage 48.60% 48.58% -0.02%
==========================================
Files 890 890
Lines 26165 26175 +10
Branches 5392 5391 -1
==========================================
Hits 12717 12717
- Misses 12527 12536 +9
- Partials 921 922 +1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
void onContextInvalidated().then(() => { | ||
unsetReadyInThisDocument(uuid); | ||
console.debug("contentScript: invalidated", uuid); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Part 1:
- revert #4058: fix race condition on tab load #4061
- remove "document ready" attribute
Demo
Screen.Recording.mov
Console sequence
The "invalidated" message here marks my "refresh extension" click:
// `import()` is only needed to avoid execution of its dependencies, not to lazy-load it | ||
// https://github.com/pixiebrix/pixiebrix-extension/issues/4058#issuecomment-1217391772 | ||
// eslint-disable-next-line import/dynamic-import-chunkname | ||
const { notify } = await import(/* webpackMode: "eager" */ "@/utils/notify"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Part 2:
- fix the issue closer to the cause
Part 3, in the future:
What does this PR do?
Closes Content script remains "ready" even after unloading #4190
Mark document as "not ready" when the context is invalidated
Unload kbar on invalidation?
Also ensure that consecutive
ensureContentScript
calls resolve at the same time, potentially viapMemoize(fn, {cache: false})
Checklist