-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Google Sheets - update-formatting #18509
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
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
WalkthroughVersion bumps across many Google Sheets actions and sources; added a new "Update Formatting" action that builds Sheets API batchUpdate requests for borders and cell formatting; introduced BORDER_STYLES and HORIZONTAL_ALIGNMENTS constants; bumped package version to 0.9.0. No other logic changes. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant Action as Update Formatting Action
participant Sheets as Google Sheets API
User->>Action: Provide spreadsheetId, sheet/range, formatting props
Action->>Action: Parse A1 range → compute start/end row & col indices
Action->>Action: Build requests[] (updateBorders?, repeatCell?)
Action->>Sheets: spreadsheets.batchUpdate(requests)
Sheets-->>Action: BatchUpdateResponse
Action-->>User: Summary + API response
note over Action,Sheets: Only provided formatting props are included in request fields
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used🧬 Code graph analysis (1)components/google_sheets/actions/update-formatting/update-formatting.mjs (2)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 5
🧹 Nitpick comments (1)
components/google_sheets/actions/update-formatting/update-formatting.mjs (1)
47-82
: Consider validating RGB color values.The RGB color props accept strings but expect values in the interval [0, 1]. The code does not validate this constraint before passing to the API, which could result in API errors if users provide invalid values (e.g., "255" or "1.5").
Consider adding validation in the run method or using a custom validator:
// In the run method, before building requests: const validateColorValue = (value, name) => { if (value !== undefined) { const num = parseFloat(value); if (isNaN(num) || num < 0 || num > 1) { throw new Error(`${name} must be a number between 0 and 1, got: ${value}`); } return num; } return undefined; }; // Then validate each color prop before use
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (29)
components/google_sheets/actions/add-column/add-column.mjs
(1 hunks)components/google_sheets/actions/add-multiple-rows/add-multiple-rows.mjs
(1 hunks)components/google_sheets/actions/add-single-row/add-single-row.mjs
(1 hunks)components/google_sheets/actions/clear-cell/clear-cell.mjs
(1 hunks)components/google_sheets/actions/clear-rows/clear-rows.mjs
(1 hunks)components/google_sheets/actions/copy-worksheet/copy-worksheet.mjs
(1 hunks)components/google_sheets/actions/create-spreadsheet/create-spreadsheet.mjs
(1 hunks)components/google_sheets/actions/create-worksheet/create-worksheet.mjs
(1 hunks)components/google_sheets/actions/delete-rows/delete-rows.mjs
(1 hunks)components/google_sheets/actions/delete-worksheet/delete-worksheet.mjs
(1 hunks)components/google_sheets/actions/find-row/find-row.mjs
(1 hunks)components/google_sheets/actions/get-cell/get-cell.mjs
(1 hunks)components/google_sheets/actions/get-spreadsheet-by-id/get-spreadsheet-by-id.mjs
(1 hunks)components/google_sheets/actions/get-values-in-range/get-values-in-range.mjs
(1 hunks)components/google_sheets/actions/insert-anchored-note/insert-anchored-note.mjs
(1 hunks)components/google_sheets/actions/insert-comment/insert-comment.mjs
(1 hunks)components/google_sheets/actions/list-worksheets/list-worksheets.mjs
(1 hunks)components/google_sheets/actions/update-cell/update-cell.mjs
(1 hunks)components/google_sheets/actions/update-formatting/update-formatting.mjs
(1 hunks)components/google_sheets/actions/update-multiple-rows/update-multiple-rows.mjs
(1 hunks)components/google_sheets/actions/update-row/update-row.mjs
(1 hunks)components/google_sheets/actions/upsert-row/upsert-row.mjs
(1 hunks)components/google_sheets/common/constants.mjs
(1 hunks)components/google_sheets/package.json
(1 hunks)components/google_sheets/sources/new-comment/new-comment.mjs
(1 hunks)components/google_sheets/sources/new-row-added-polling/new-row-added-polling.mjs
(1 hunks)components/google_sheets/sources/new-row-added/new-row-added.mjs
(1 hunks)components/google_sheets/sources/new-updates/new-updates.mjs
(1 hunks)components/google_sheets/sources/new-worksheet/new-worksheet.mjs
(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
components/google_sheets/actions/update-formatting/update-formatting.mjs (2)
components/google_sheets/common/constants.mjs (2)
HORIZONTAL_ALIGNMENTS
(103-107)BORDER_STYLES
(93-101)components/google_sheets/google_sheets.app.mjs (4)
startRow
(142-142)endRow
(143-145)startCol
(138-138)endCol
(139-141)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Lint Code Base
- GitHub Check: Publish TypeScript components
- GitHub Check: Verify TypeScript components
🔇 Additional comments (27)
components/google_sheets/actions/update-row/update-row.mjs (1)
13-13
: LGTM: Version bump aligns with package release.The version increment from 0.1.15 to 0.1.16 is consistent with the broader versioning pass across Google Sheets actions in this PR.
components/google_sheets/actions/list-worksheets/list-worksheets.mjs (1)
7-7
: LGTM: Version bump aligns with package release.The version increment from 0.1.11 to 0.1.12 is consistent with the coordinated versioning update across multiple Google Sheets actions.
components/google_sheets/actions/add-column/add-column.mjs (1)
7-7
: LGTM: Version bump aligns with package release.The version increment from 0.1.11 to 0.1.12 is consistent with the package-wide versioning update accompanying the new formatting feature.
components/google_sheets/actions/upsert-row/upsert-row.mjs (1)
27-27
: Version bump looks goodNo behavioral changes introduced; the metadata update keeps the action versioning consistent with the rest of the suite.
components/google_sheets/sources/new-row-added-polling/new-row-added-polling.mjs (1)
11-11
: Source version increment verifiedVersion metadata now reflects the new release while leaving logic untouched.
components/google_sheets/actions/add-multiple-rows/add-multiple-rows.mjs (1)
14-14
: Action version update acknowledgedThe version increment matches the broader release adjustments and preserves existing behavior.
components/google_sheets/sources/new-updates/new-updates.mjs (1)
12-12
: LGTM! Version bump is appropriate.The patch version increment aligns with the package-level update and contains no functional changes.
components/google_sheets/actions/update-multiple-rows/update-multiple-rows.mjs (1)
12-12
: LGTM! Version bump is appropriate.The patch version increment aligns with the package-level update and contains no functional changes.
components/google_sheets/actions/insert-anchored-note/insert-anchored-note.mjs (1)
8-8
: LGTM! Version bump is appropriate.The patch version increment aligns with the package-level update and contains no functional changes.
components/google_sheets/actions/add-single-row/add-single-row.mjs (1)
13-13
: LGTM! Version bump is appropriate.The patch version increment aligns with the package-level update and contains no functional changes.
components/google_sheets/package.json (1)
3-3
: LGTM! Minor version bump is appropriate for the new formatting action.The version increment from 0.8.12 to 0.9.0 correctly follows semantic versioning, reflecting the addition of the new Update Formatting action and associated constants (BORDER_STYLES, HORIZONTAL_ALIGNMENTS).
components/google_sheets/actions/get-cell/get-cell.mjs (1)
10-10
: LGTM! Metadata version bump.The version increment is consistent with the package-wide release (0.9.0) accompanying the new Update Formatting action.
components/google_sheets/actions/find-row/find-row.mjs (1)
10-10
: LGTM! Metadata version bump.The version increment aligns with the coordinated release for new formatting capabilities.
components/google_sheets/actions/copy-worksheet/copy-worksheet.mjs (1)
7-7
: LGTM! Metadata version bump.The version increment is consistent with the package release strategy.
components/google_sheets/actions/get-spreadsheet-by-id/get-spreadsheet-by-id.mjs (1)
7-7
: LGTM! Version bump is appropriate.The patch version increment aligns with the package release that includes the new Update Formatting action.
components/google_sheets/sources/new-worksheet/new-worksheet.mjs (1)
12-12
: LGTM! Version bump is appropriate.The patch version increment aligns with the package release that includes the new Update Formatting action.
components/google_sheets/actions/get-values-in-range/get-values-in-range.mjs (1)
10-10
: LGTM! Version bump is appropriate.The patch version increment aligns with the package release that includes the new Update Formatting action.
components/google_sheets/sources/new-comment/new-comment.mjs (1)
9-9
: LGTM! Version bump is appropriate.The patch version increment aligns with the package release that includes the new Update Formatting action.
components/google_sheets/actions/delete-worksheet/delete-worksheet.mjs (1)
7-7
: LGTM - Coordinated version bump.The version increment aligns with the package-level update to 0.9.0 and the introduction of new formatting capabilities in this PR.
components/google_sheets/common/constants.mjs (1)
113-114
: LGTM - New constants properly exported.The new formatting constants are correctly added to the module exports for use in the update-formatting action.
components/google_sheets/actions/update-formatting/update-formatting.mjs (7)
1-11
: LGTM - Clean imports and metadata.The action properly imports the new constants and references the official Google Sheets formatting documentation.
83-155
: LGTM - Comprehensive formatting props.The prop definitions cover font styling, alignment, and border options effectively. Using the imported constants for
options
ensures consistency with the API.
175-229
: LGTM - Border request logic is correct.The conditional assembly of the
updateBorders
request properly includes only the border properties that were specified by the user.
238-253
: LGTM - Background color logic is correct.The background color properties are conditionally assembled and the field is properly tracked for the fields mask.
254-270
: LGTM - Text color logic is correct.The foreground color is properly nested under
textFormat
and tracked in the fields mask with the correct pathtextFormat.foregroundColor
.
292-296
: LGTM - Horizontal alignment and fields mask are correct.The horizontal alignment is properly added to
userEnteredFormat
, and the fields mask is correctly constructed by joining all tracked field paths.
302-309
: LGTM - API call and response handling are correct.The
batchUpdate
call is properly structured with the assembled requests, and the summary export provides useful feedback to the user.
components/google_sheets/actions/update-formatting/update-formatting.mjs
Show resolved
Hide resolved
components/google_sheets/actions/update-formatting/update-formatting.mjs
Show resolved
Hide resolved
components/google_sheets/actions/update-formatting/update-formatting.mjs
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @michelle0927, LGTM! Ready for QA!
Resolves #17905
Summary by CodeRabbit
New Features
Chores