-
Notifications
You must be signed in to change notification settings - Fork 5.5k
[ACTION] Improve Notion actions to loop block-creation, comply with request limits #13889
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
[ACTION] Improve Notion actions to loop block-creation, comply with request limits #13889
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
|
@jcortes is attempting to deploy a commit to the Pipedreamers Team on Vercel. A member of the Team first needs to authorize it. |
WalkthroughThe pull request introduces a new method, Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant NotionAPI
participant AppendBlock
User->>AppendBlock: Request to append blocks
AppendBlock->>AppendBlock: chunkArray(children)
AppendBlock->>NotionAPI: Append chunk of blocks
NotionAPI-->>AppendBlock: Return results
AppendBlock->>AppendBlock: Collect results
AppendBlock->>User: Total blocks appended
Assessment against linked issues
Tip OpenAI O1 model for chat
Recent review detailsConfiguration used: CodeRabbit UI Files selected for processing (2)
Files skipped from review as they are similar to previous changes (2)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
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
Outside diff range, codebase verification and nitpick comments (2)
components/notion/actions/append-block/append-block.mjs (2)
51-57: ThechunkArraymethod implementation looks good.The method correctly splits the input array into chunks of the specified size and can handle arrays smaller than the chunk size.
Consider using
Array.fromfor a more concise implementation.You can replace the for loop with
Array.fromto make the implementation more concise:chunkArray(array, chunkSize = 1000) { return Array.from({ length: Math.ceil(array.length / chunkSize) }, (_, i) => array.slice(i * chunkSize, (i + 1) * chunkSize) ); }
109-115: The changes to therunmethod look good.The changes allow appending blocks in manageable sizes, which is useful for handling larger datasets and complies with the Notion API's request limits.
Consider adding error handling.
The
runmethod should handle potential errors that may occur while appending blocks. You can wrap the block appending logic in a try-catch block and handle errors appropriately.
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- components/notion/actions/append-block/append-block.mjs (3 hunks)
- components/notion/package.json (1 hunks)
Files skipped from review due to trivial changes (1)
- components/notion/package.json
Additional comments not posted (2)
components/notion/actions/append-block/append-block.mjs (2)
9-9: Version update looks good.The version change from
0.2.13to0.2.14is approved.
117-119: The changes to the summary message look good.The changes correctly calculate and report the total number of appended blocks, enhancing the feedback provided to the user.
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.
LGTM!
a96a126 to
b95434f
Compare
8239d54 to
7761203
Compare
|
/approve |
… blocks each
WHY
Added
chunkArrayfunction to get chunks of 1000 blocks eachResolves #13857
Summary by CodeRabbit
New Features
Chores
@pipedream/notionpackage to 0.1.20.