Repository navigation
feat(sheets): let a host send the grid's requests and upload bytes - #66
Merged
Merged
Conversation
SheetsConfig.transport takes a host's fetch for every GraphQL request (data, storage, and standalone auth) and a put for every upload's bytes, so a host whose page origin no API lists for CORS, such as a desktop app, can send them from its own process. Sheets keeps its own handling of each answer: the bearer token, 401 and onAuthError, partial rows, an expired upload URL renewed once. The page's own PUT now has the same contract as a host's put, so one place turns any answer into an upload error, and only a cancel of the upload's own signal is an AbortError: an upload that failed for another reason never ends like a cancel.
The Sheets root is display: contents, so its toolbar and grid are children of the host's container. In a block container the grid is as tall as the container plus the toolbar and its status bar falls out of view, and a container that is overflow: hidden can be scrolled by the grid's focus, away from its overlay editors.
|
Review complete. No blocking issues — approved ✅; 1 nitpick below. 🧹 Nitpicks (1) — 🟢 1 low
This PR threads an optional host transport through the Sheets data, auth, and storage upload paths, letting embedding hosts intercept or proxy network calls instead of the package falling back to
Review verified transport threading, abort semantics, and API-compat concerns across all changed files; one minor export gap remains. Reviewed commit: bdddce8 |
transferFile took the requester and the host's put as two positional arguments, and every caller split them out of the same storage transport. An UploadRoute names the pair: request asks the storage API for a signed URL, put sends the bytes. Each upload path builds its route from its storage in one place (createUploadRoute for the plane's own mutation, discoveredUploadRoute for the two discovery paths), and putFile keeps its earlier (url, body, options) shape.
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
A host can now send the grid's network traffic itself. Constructive Desktop needs this: its window loads from
http://localhost:5173(dev) orfile://, an origin no API lists in itscors_settings, and since constructive-io/constructive#1974 the GraphQL server refuses unlisted origins.SheetsConfig.transportfetchcarries every GraphQL request: data, storage, and auth in standalone mode. It answers like the globalfetch.putcarries each upload's bytes to its presigned URL, with exactly the payload's signed headers: the grid's file columns andcreateSheetsUpload(uploadToFilesTabletakes it asstorage.put). It resolves with the answer whatever its status, and rejects only when no answer came.onAuthError, partial rows, error codes, an expired upload URL renewed once.fetch/XMLHttpRequestsends that part, as before. An injectedexecute,storage.executeorexecuteUploadstill replaces it.One upload path
UploadRoutepairs itsrequest(the mutation that issues a signed URL) with itsput; each path builds it from its storage transport (createUploadRoute,discoveredUploadRoute), andtransferFile(file, route, options)takes it.fetch) now has the same contract as a host'sput, so one sender turns any answer into an upload error, for both.signalis anAbortError. Before, anyAbortErrorended the upload like a user cancel, so an upload that failed elsewhere could sit at "uploading" with no error.presignedPut(earlier API) sends exactly what it sent before.Docs
docs/HOST_INTEGRATION.md: a "Host transport" section.docs/EMBEDDING.md: the grid's container must be a flex column withmin-height: 0(the Sheets root isdisplay: contents), clipped withoverflow: clip. A block container hid the status bar, and anoverflow: hiddenone could be scrolled by the grid's focus, away from its overlay editors.🤖 Generated with Claude Code
https://claude.ai/code/session_017WbsG8xSPVNk24sN2QThLw