-
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
11601d2
Mark document as "not ready" when the context is invalidated
fregante 952bbe7
Merge remote-tracking branch 'origin' into F/bug/ready-or-not-here-i-…
fregante bef3e9a
Just ensure the messenger isn't loaded unless used
fregante 3aeb920
Lint
fregante 93f7aa8
Merge branch 'main' into F/bug/ready-or-not-here-i-come
BLoe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,6 @@ | |
*/ | ||
|
||
import { expectContext } from "@/utils/expectContext"; | ||
import notify from "@/utils/notify"; | ||
import { once } from "lodash"; | ||
import { | ||
CONTEXT_INVALIDATED_ERROR, | ||
|
@@ -30,7 +29,11 @@ const id = "connection-lost"; | |
* Display a notification when the background page unloads/reloads because at this point | ||
* all communcation becomes impossible. | ||
*/ | ||
export function notifyContextInvalidated(): void { | ||
export async function notifyContextInvalidated(): Promise<void> { | ||
// `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 commentThe reason will be displayed to describe this comment to others. Learn more. Part 2:
Part 3, in the future: |
||
notify.error({ | ||
id, | ||
message: "PixieBrix was updated or restarted. Reload the page to continue", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
Demo
Screen.Recording.mov
Console sequence
The "invalidated" message here marks my "refresh extension" click: