Skip to content

refactor(site/src/pages/AgentsPage): discriminate upload terminal states - #30630

Closed
DanielleMaywood wants to merge 1 commit into
mainfrom
refactor/agents-upload-state-types
Closed

DanielleMaywood wants to merge 1 commit into
mainfrom
refactor/agents-upload-state-types

Conversation

@DanielleMaywood

Copy link
Copy Markdown
Collaborator

Part 2 of a stack splitting #30545.

Turns the composer upload states into discriminated unions so terminal payloads only exist on the status that owns them:

  • UploadState (AttachmentPreview.tsx): uploaded requires fileId, error requires error, and in-progress states carry neither. draftWarning stays available on every status.
  • WorkspaceFileUpload (useWorkspaceFileUploads.ts): uploaded requires response, error requires error. setUploadResult replaces the state instead of merging it, so no stale error or response survives a status change.
  • useChatDraftAttachments.ts: views, registry entries, and snapshots hold a single uploadState instead of loose status/fileId/error/draftWarning fields. Draft warnings carry across status transitions as before.
  • Consumers drop the fallbacks and guards that the types now make redundant (?? "Upload failed", upload.response ? branches, && state.fileId).

No behavior change is intended. Cancellation, retry, persistence warnings, and missing map entries are handled the same way as before.

Generated by Coder Agents on behalf of @DanielleMaywood.

@linear-code

linear-code Bot commented Oct 13, 2026

Copy link
Copy Markdown

CODAGT-1405

@DanielleMaywood

Copy link
Copy Markdown
Collaborator Author

Closing stack until can be re-prioritized

@DanielleMaywood
DanielleMaywood temporarily deployed to main November 10, 2026 15:45 — with GitHub Actions Inactive
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 10, 2026

This branch was previously deployed

1 inactive deployment
main — 9a24d800 Deployed Nov 10, 2026 by DanielleMaywood via cla #253388
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant