- 
                Notifications
    You must be signed in to change notification settings 
- Fork 5.5k
Notion: Append Block to Parent Action #14202
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
Notion: Append Block to Parent Action #14202
Conversation
| @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 updates to the  Changes
 Assessment against linked issues
 Possibly related PRs
 Suggested labels
 Suggested reviewers
 Poem
 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 ( | 
| The latest updates on your projects. Learn more about Vercel for Git ↗︎ | 
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 and nitpick comments (1)
components/notion/actions/append-block/append-block.mjs (1)
Line range hint
51-58: Good addition of base methods and chunkArray utility.The spreading of base methods promotes code reuse and consistency. The
chunkArraymethod is a useful utility for handling large datasets or API limitations.Consider making the chunk size configurable by adding it as a prop or environment variable. This would allow for easier adjustment based on API limits or performance requirements without code changes.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
- components/notion/actions/append-block/append-block.mjs (2 hunks)
- components/notion/package.json (1 hunks)
✅ Files skipped from review due to trivial changes (1)
- components/notion/package.json
🔇 Additional comments (3)
components/notion/actions/append-block/append-block.mjs (3)
9-9: Version update looks good.The increment from 0.2.14 to 0.2.15 is appropriate for the changes made in this PR.
Line range hint
1-124: Overall assessment: Good improvements to the Notion Append Block action.The changes in this PR effectively address the objectives by enhancing the functionality and efficiency of the "Append Block to Parent" action. The implementation now handles various block types more comprehensively and uses chunking for better performance.
A few suggestions have been made to further improve error handling, logging, and robustness. These enhancements would make the action more resilient and easier to maintain.
To ensure that these changes don't introduce any regressions or unintended side effects, consider running the following verification:
#!/bin/bash # Description: Check for any other files that might be affected by these changes # Look for other files using the notion-append-block action rg --type javascript "notion-append-block" ./components # Check for any hardcoded version numbers that might need updating rg --type javascript "0\.2\.14" ./componentsThis will help identify any other parts of the codebase that might need attention due to these changes.
Line range hint
60-124: Improved block appending logic and efficiency.The updated
runmethod now handles various block types more comprehensively and efficiently. The use of chunking for processing large numbers of blocks is a good optimization.Consider the following improvements:
- Add explicit error handling for API calls to improve robustness.
- Consider adding logging or debug statements to aid in troubleshooting.
- The
blockObjectsparsing could be more robust. Consider using a try-catch block when parsing JSON:if (this.blockObjects?.length > 0) { for (const obj of this.blockObjects) { try { const child = typeof obj === "string" ? JSON.parse(obj) : obj; children.push(child); } catch (error) { console.error(`Failed to parse block object: ${error.message}`); // Optionally, you could skip this item or throw an error } } }
- Consider adding a check for the maximum allowed blocks per request in the Notion API to ensure compliance.
To verify the maximum allowed blocks per request in the Notion API, we can check the official documentation:
This will help ensure that the chunking logic aligns with Notion's API limitations.
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 @jcortes, LGTM! Ready for QA!
WHY
Fixed bug in Append Block to Parent action
Resolves #14159
Summary by CodeRabbit
New Features
chunkArray, to split arrays into smaller chunks for improved data handling.Bug Fixes
runmethod for more efficient appending of blocks, ensuring accurate retrieval and formatting.Chores
notion-append-blockaction and the@pipedream/notionpackage to reflect the latest changes.