Repository navigation
Refresh the Artifacts page on changes, not every 5 seconds - #441
Merged
abhishekgahlot2 merged 1 commit intoNov 11, 2026
Merged
abhishekgahlot2 merged 1 commit into
abhishekgahlot2 merged 1 commit into
Conversation
The Artifacts page downloaded the whole file list every 5 seconds for as long as it stayed open, background tabs included, although artifact change events from the org stream already reload it. Every one of those polls also spun the refresh icon and disabled the button. - The 5 second interval is gone. The list re-reads on an artifact change, each time the org stream opens (which covers the gap after the server-rendered snapshot and anything missed while the stream was down), and when the tab gets focus or becomes visible again, the way the Automations recovery hook covers changes made elsewhere. - One read at a time: changes that arrive while a read is in flight queue a single follow-up read, so a burst of published files costs two requests instead of one per file. - Only a click on Refresh (or Try again on the unavailable state) spins the icon. A click during a quiet read still gets a fresh read after it. A new interaction test mounts the page under happy-dom with a held fetch and a stand-in org stream. It checks that the page sets no interval and reads nothing before the stream opens, then reads once on open and on reopen, on a change, on focus and on visibility; that a burst of four changes makes two reads; and that only a click spins the icon. Every case fails on the old component. Closes useagenthq#289
Contributor
|
Merged, thanks @officialasishkumar. Reloading on the org change stream instead of every 5 seconds cuts idle requests, and it still picks up every artifact write. |
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
By opening this pull request you agree to the Contributor License Agreement. On your first pull request a bot asks you to sign it with a one-line comment.
Fixes #289
The Artifacts page fetched the whole file list every 5 seconds (
setIntervalwithREFRESH_MS = 5_000) for as long as it stayed open, background tabs included. That is 12GET /api/artifactsa minute, even though artifact change events from the org stream already reload the list. Each poll also went through the same path as the Refresh button, so the icon spun and the button was disabled every 5 seconds with nobody touching it.What changed
All code changes are in
frontend/app/(library)/agent/artifacts/live-artifacts.tsx:useOrgChanges's open callback. The first open covers the gap between the server-rendered snapshot and the stream. Each reopen covers anything missed while the stream was down, including a backend that went away and came back.use-automation-recovery.tsdoes for Automations{ manual: true }. Every other read is quiet, the same rule Spin the Files refresh icon only on a manual refresh #397 set for the thread's Files panel. A click that lands during a quiet read still gets a fresh read after it, and the icon spins until that read is answered.With no changes, focus or reconnects, the page now makes one request in its first minute (when the stream opens) and none after it.
Tests
New
live-artifacts.interaction.test.tsxmountsLiveArtifactsunder happy-dom. Requests go through the realbackendFetchto a held fetch stub, and a stand-inEventSourcelets the test open the stream and send change events in the backend's format:visibilitychangeeach read onceAll five fail on
main.Checks with Bun 1.3.14:
cd frontend && bun run test: 1936 pass, 0 failcd frontend && bun run typecheck: passescd frontend && bunx biome linton the two changed files: no findingsI did not run
bun run buildor open the page in a browser, so I have no screenshots or request counts from a real session. The before and after counts above come from the code and the tests.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.