feat(google-sheets): expose pending row count before flush - #960
Merged
Conversation
Sheet#onProgress only fires after a chunk's batchUpdate resolves, so callers had no way to show anything while the final buffered chunk was in flight. Add a pendingCount getter so callers can report how many rows are about to be sent right before calling flush().
Cover the JSDoc claim that pendingCount reflects rows held past SEND_CHUNK_SIZE while a lazy row suspends auto-flush, and add the @example the project's public-API JSDoc convention requires.
Complete the state-transition coverage for pendingCount alongside the existing sentCount coverage for the same [Symbol.asyncDispose] path.
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.
Summary
Sheet#onProgressonly fires after a chunk'sbatchUpdateresolves, so callers had no way toshow anything while the final buffered chunk (below the 2500-row auto-flush threshold) was in
flight — the send just sits there silently until it completes.
pendingCountgetter that exposes the number of buffered-but-unsent rows, so a caller canreport how many rows are about to be sent right before calling
flush().Consumer
nitpicker's
create-sheets.ts(Insert rows: <name>step) will usesheet.pendingCountto show a"flushing N rows..." message before its final
sheet.flush()call, once this package is published.That change is tracked separately and depends on this package's release.
Test plan
yarn test(2047 tests, all passing) — added coverage for the threshold boundary, thepost-auto-flush remainder,
flush()draining to 0, lazy-row buffering pastSEND_CHUNK_SIZE, and[Symbol.asyncDispose]draining to 0yarn buildyarn lint(0 errors)