-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Google Sheet - Create Spreadsheet: allow create spreadsheet in a folder #16664
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
base: master
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ |
WalkthroughAn optional Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Action
participant GoogleSheetsAPI
User->>Action: Trigger create-spreadsheet (with optional folderId)
Action->>GoogleSheetsAPI: Create spreadsheet
GoogleSheetsAPI-->>Action: Spreadsheet details
alt folderId specified or not "My Drive"
Action->>GoogleSheetsAPI: Move spreadsheet to folder (folderId or driveId)
GoogleSheetsAPI-->>Action: Updated spreadsheet metadata
Action-->>User: Return updated metadata
else
Action-->>User: Return spreadsheet details
end
Assessment against linked issues
Suggested reviewers
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
components/google_sheets/actions/create-spreadsheet/create-spreadsheet.mjsOops! Something went wrong! :( ESLint: 8.57.1 Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs ✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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: 0
🧹 Nitpick comments (2)
components/google_sheets/actions/create-spreadsheet/create-spreadsheet.mjs (2)
79-81
: Consider error handling for file updates.The implementation correctly uses
folderId
as the primary choice, falling back todrive
when needed. However, there's no error handling if theupdateFile
operation fails.Consider adding try/catch blocks to handle potential errors during file updates:
- const spreadsheet = await updateFile(response.spreadsheetId, { - addParents: folderId || drive, - }); + try { + const spreadsheet = await updateFile(response.spreadsheetId, { + addParents: folderId || drive, + }); + + return getSpreadsheet(spreadsheet.id); + } catch (error) { + console.error("Error moving spreadsheet to folder:", error); + // Still return the created spreadsheet even if move fails + return response; + }
83-83
: Validate spreadsheet ID.Consider adding a check to ensure
spreadsheet.id
exists before attempting to fetch the spreadsheet.- return getSpreadsheet(spreadsheet.id); + return spreadsheet?.id ? getSpreadsheet(spreadsheet.id) : response;
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (2)
components/google_sheets/actions/create-spreadsheet/create-spreadsheet.mjs
(4 hunks)components/google_sheets/package.json
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
- GitHub Check: Verify TypeScript components
- GitHub Check: pnpm publish
- GitHub Check: Publish TypeScript components
- GitHub Check: Lint Code Base
🔇 Additional comments (5)
components/google_sheets/package.json (1)
3-3
: Version bump is appropriate.The version increment from 0.8.1 to a patch version 0.8.2 is suitable for this feature addition since it enhances functionality without breaking existing behavior.
components/google_sheets/actions/create-spreadsheet/create-spreadsheet.mjs (4)
7-7
: Version number correctly incremented.The action version bump from 0.1.9 to 0.1.10 aligns with the package version increment and appropriately reflects the non-breaking enhancement.
23-33
: Well-structured folder selection property.The new
folderId
property is properly implemented as an optional parameter with clear description. The dynamic propDefinition correctly uses the selected drive context to filter available folders.
50-50
: Correct property destructuring.The
folderId
is properly destructured from the component's properties.
75-77
: Logical conditional return.This condition correctly returns the response immediately when no folder is specified and the drive is "My Drive", avoiding unnecessary API calls.
Resolves #16643
Summary by CodeRabbit
New Features
Chores