-
Notifications
You must be signed in to change notification settings - Fork 3.2k
fix(desktop): remove 0.5.9+ perf regressions, speed up get_channels #5599
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
Merged
+2,738
−484
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
68d8039
fix(desktop): only make macOS webview transparent when glass is enabled
wpfleger96 9340c49
fix(desktop): stale-gate focus-return refetches across query families
wpfleger96 d0f4234
perf(desktop): move localStorage sweep and profile trim off hot paths
wpfleger96 65e0359
fix(desktop): harden localStorage sweep and profile trim failure paths
wpfleger96 c2020a9
fix(desktop): keep live-view queries fresh across focus returns
wpfleger96 3cd6c74
fix(desktop): keep macOS window opaque if a glass toggle partially fails
wpfleger96 7e05d4b
perf(desktop): parallelize get_channels and skip unchanged channel pa…
wpfleger96 dbe7ded
fix(desktop): create the main window opaque and scope glass to the we…
wpfleger96 9f50cbf
fix(desktop): keep workflow lists fresh across focus returns
wpfleger96 d264cca
test(desktop): align e2e mock and spec helpers with the get_channels …
wpfleger96 9e77ca1
test(desktop): drive focus-policy tests from production query options
wpfleger96 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
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| import assert from "node:assert/strict"; | ||
| import { afterEach, test } from "node:test"; | ||
|
|
||
| import { | ||
| focusManager, | ||
| QueryClient, | ||
| QueryObserver, | ||
| } from "@tanstack/react-query"; | ||
|
|
||
| import { | ||
| agentsFocusRefetchPolicy, | ||
| managedAgentLogFocusRefetchPolicy, | ||
| } from "./hooks.ts"; | ||
|
|
||
| afterEach(() => { | ||
| focusManager.setFocused(undefined); | ||
| }); | ||
|
|
||
| async function focusRefetchCount({ ageMs, policy }) { | ||
| focusManager.setFocused(false); | ||
| const queryClient = new QueryClient({ | ||
| defaultOptions: { queries: { retry: false } }, | ||
| }); | ||
| queryClient.mount(); | ||
|
|
||
| const queryKey = ["focus-refetch-policy", policy.staleTime, ageMs]; | ||
| queryClient.setQueryData(queryKey, "cached", { | ||
| updatedAt: Date.now() - ageMs, | ||
| }); | ||
| let fetchCount = 0; | ||
| const observer = new QueryObserver(queryClient, { | ||
| queryKey, | ||
| queryFn: async () => { | ||
| fetchCount += 1; | ||
| return "refetched"; | ||
| }, | ||
| refetchOnMount: false, | ||
| ...policy, | ||
| }); | ||
| const unsubscribe = observer.subscribe(() => {}); | ||
|
|
||
| focusManager.setFocused(true); | ||
| await new Promise((resolve) => setImmediate(resolve)); | ||
|
|
||
| unsubscribe(); | ||
| queryClient.unmount(); | ||
| return fetchCount; | ||
| } | ||
|
|
||
| test("agents: skips fresh focus refetch", async () => { | ||
| assert.equal( | ||
| await focusRefetchCount({ | ||
| ageMs: agentsFocusRefetchPolicy.staleTime - 1_000, | ||
| policy: agentsFocusRefetchPolicy, | ||
| }), | ||
| 0, | ||
| ); | ||
| }); | ||
|
|
||
| test("agents: refetches genuinely stale data on focus", async () => { | ||
| assert.equal( | ||
| await focusRefetchCount({ | ||
| ageMs: agentsFocusRefetchPolicy.staleTime + 1, | ||
| policy: agentsFocusRefetchPolicy, | ||
| }), | ||
| 1, | ||
| ); | ||
| }); | ||
|
|
||
| test("managed-agent-log: skips focus refetch when data is fresher than one poll tick", async () => { | ||
| assert.equal( | ||
| await focusRefetchCount({ | ||
| ageMs: managedAgentLogFocusRefetchPolicy.staleTime - 1_000, | ||
| policy: managedAgentLogFocusRefetchPolicy, | ||
| }), | ||
| 0, | ||
| ); | ||
| }); | ||
|
|
||
| test("managed-agent-log: refetches on focus when data is older than one poll tick", async () => { | ||
| assert.equal( | ||
| await focusRefetchCount({ | ||
| ageMs: managedAgentLogFocusRefetchPolicy.staleTime + 1, | ||
| policy: managedAgentLogFocusRefetchPolicy, | ||
| }), | ||
| 1, | ||
| ); | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.