Skip to content

Conversation

@GTFalcao
Copy link
Collaborator

@GTFalcao GTFalcao commented Apr 8, 2025

The Retrieve Content prop was renamed back to Retrieve Children and changed to a three-option prop instead of a boolean (still optional).

  • 'All Children' works the same as before, recursively retrieving all child blocks.
  • 'Sub-Pages Only' filters these children to include only sub-pages.
  • 'None' (same as default of not choosing anything, will only retrieve the page block itself).

I've special-cased this to check for a boolean value in the code and keep the same behavior (true = 'all children', false = 'none') in case users update the action and don't change the prop's value, so it'll function exactly as it did before.

Finally, the markdown is now returned as well as the blocks, such that enabling the 'Retrieve as Markdown' prop returns this:

{
  markdown: 'my content'
  block: {
    id: 'block_id',
    children: [ ... ],
    // ...
  }
}

while not enabling it keeps the same behavior as before it existed.

{
  id: 'block_id',
  children: [ ... ],
  // ...
}

Summary by CodeRabbit

  • New Features
    • Enhanced content retrieval now offers flexible filtering options, allowing you to select between retrieving all content, sub-pages only, or none.
    • Added support for optionally returning page content as markdown alongside standard details.
  • Improvements
    • Streamlined retrieval configurations provide a more intuitive and consistent experience when managing nested content.
  • Version Updates
    • Updated version numbers for various components to reflect the latest enhancements and improvements.

@vercel
Copy link

vercel bot commented Apr 8, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
docs-v2 ⬜️ Ignored (Inspect) Visit Preview Apr 8, 2025 10:21pm
pipedream-docs ⬜️ Ignored (Inspect) Apr 8, 2025 10:21pm
pipedream-docs-redirect-do-not-edit ⬜️ Ignored (Inspect) Apr 8, 2025 10:21pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Apr 8, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This update refactors the retrieval logic for Notion blocks. In the retrieve-block action, the retrieveChildren property is updated from a boolean to a string with new options, and the handling of markdown content is adjusted. Similarly, the Notion app’s retrieveBlockChildren method now uses a boolean flag (subpagesOnly) to filter child blocks, propagating this filter recursively. Additionally, version numbers are incremented in both the action and package files.

Changes

File Change Summary
components/notion/actions/retrieve-block/retrieve-block.mjs - Version updated from 0.1.0 to 0.2.0.
- Changed retrieveChildren property type from boolean to string with new options ("All Children", "Sub-Pages Only", "None") and updated its label and description.
- Modified the run method to store markdown content in a variable and adjust the returned object.
components/notion/notion.app.mjs - Updated method signature of retrieveBlockChildren: replaced the params parameter with a subpagesOnly boolean (defaulting to false).
- Adjusted filtering logic to include only 'child_page' type blocks when subpagesOnly is true, including in recursive calls.
components/notion/package.json - Package version updated from "0.5.0" to "0.6.0".
components/notion/actions/append-block/append-block.mjs - Version updated from 0.3.1 to 0.3.2.
components/notion/actions/duplicate-page/duplicate-page.mjs - Version updated from 0.0.11 to 0.0.12.

Possibly related PRs

Suggested reviewers

  • dannyroosevelt

Poem

In the garden of code I hop,
Changing bits with a skip and a pop.
New strings replace old booleans today,
With options to choose the Notion way.
Version numbers leap, the code sings along,
A rabbit’s joy in every line of the song!
🐇✨

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

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

components/notion/actions/append-block/append-block.mjs

Oops! Something went wrong! :(

ESLint: 8.57.1

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs
at packageResolve (node:internal/modules/esm/resolve:839:9)
at moduleResolve (node:internal/modules/esm/resolve:908:18)
at defaultResolve (node:internal/modules/esm/resolve:1038:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:557:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:525:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:246:38)
at ModuleJob._link (node:internal/modules/esm/module_job:126:49)

components/notion/actions/duplicate-page/duplicate-page.mjs

Oops! Something went wrong! :(

ESLint: 8.57.1

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs
at packageResolve (node:internal/modules/esm/resolve:839:9)
at moduleResolve (node:internal/modules/esm/resolve:908:18)
at defaultResolve (node:internal/modules/esm/resolve:1038:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:557:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:525:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:246:38)
at ModuleJob._link (node:internal/modules/esm/module_job:126:49)


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 89187bc and bc9c236.

📒 Files selected for processing (2)
  • components/notion/actions/append-block/append-block.mjs (1 hunks)
  • components/notion/actions/duplicate-page/duplicate-page.mjs (1 hunks)

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

});
},
async retrieveBlockChildren(block, params = {}) {
async retrieveBlockChildren(block, subpagesOnly = false) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the record, I've checked that all instances of this method being called did not include a params argument, so it was always initialized as an empty object - hence I changed it to a variable declaration instead.

@GTFalcao
Copy link
Collaborator Author

GTFalcao commented Apr 8, 2025

I'm also skipping the mass-version-bumping that is usually required for the check to pass, and opting to update only the versions of the components that are affected by the change (double-checked).

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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 (4)
components/notion/notion.app.mjs (1)

339-339: Consider simplifying the filter expression

The filtering logic is functional but a bit complex. Consider splitting it into a more readable form for better maintainability.

-        children.push(...(results.filter((child) => !subpagesOnly || child.type === "child_page")));
+        const filteredResults = subpagesOnly 
+          ? results.filter((child) => child.type === "child_page")
+          : results;
+        children.push(...filteredResults);
components/notion/actions/retrieve-block/retrieve-block.mjs (3)

36-39: Consider renaming for consistency with response format

For better consistency with the documented response format, consider renaming markdownContent to markdown.

-    let markdownContent;
+    let markdown;
     if (this.retrieveMarkdown) {
-      markdownContent = await this.notion.getPageAsMarkdown(this.blockId);
+      markdown = await this.notion.getPageAsMarkdown(this.blockId);
     }

53-53: Unnecessary null coalescing operator

Since block.children is already defined on line 50, the null coalescing operator (??) is unnecessary here.

-    $.export("$summary", `Successfully retrieved block${retrieveChildren
-      ? ` with ${block.children.length ?? 0} ${subpagesOnly
+    $.export("$summary", `Successfully retrieved block${retrieveChildren
+      ? ` with ${block.children.length} ${subpagesOnly

57-62: Consider consistent naming in response format

For consistency with the documented response format mentioned in the PR objectives, consider renaming markdownContent to markdown in the returned object.

-    return markdownContent
+    return markdown
       ? {
-        markdownContent,
+        markdown,
         block,
       }
       : block;
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 87726b1 and 89187bc.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (3)
  • components/notion/actions/retrieve-block/retrieve-block.mjs (2 hunks)
  • components/notion/notion.app.mjs (2 hunks)
  • components/notion/package.json (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Verify TypeScript components
  • GitHub Check: pnpm publish
  • GitHub Check: Publish TypeScript components
🔇 Additional comments (7)
components/notion/package.json (1)

3-3: Version update is appropriate for the new features

The increment from "0.5.0" to "0.6.0" correctly follows semantic versioning principles for backward-compatible functionality additions. This aligns with the changes introduced in this PR.

components/notion/notion.app.mjs (2)

328-329: Good change to method signature

Changing from a generic params object to a specific subpagesOnly boolean parameter improves the method's clarity and makes its purpose more explicit. The initialization of an empty params object inside the method is also appropriate.


343-343: Correctly propagates filtering option

The recursive call properly passes the subpagesOnly parameter, ensuring consistent filtering throughout the recursion chain.

components/notion/actions/retrieve-block/retrieve-block.mjs (4)

7-7: Version increment is appropriate

The bump from "0.1.0" to "0.2.0" is correct for a non-breaking feature enhancement.


18-26: Good enhancement to retrieveChildren property

Converting from a boolean to a string type with meaningful options improves the API's flexibility. The options are well-labeled and the description clearly explains the functionality.


41-43: Clear setup for child retrieval options

Good extraction of the retrieveChildren property and setting up the subpagesOnly flag based on the selected option.


45-51: Backward compatibility is well maintained

Excellent implementation of backward compatibility by including true as a valid option for child retrieval. This ensures existing integrations continue to work.

@GTFalcao GTFalcao merged commit 2b18728 into master Apr 8, 2025
9 of 11 checks passed
@GTFalcao GTFalcao deleted the notion-markdown-followup branch April 8, 2025 22:23
@GTFalcao GTFalcao moved this to Ready for PR Review in Component (Source and Action) Backlog Apr 8, 2025
@GTFalcao
Copy link
Collaborator Author

GTFalcao commented Apr 8, 2025

We shipped this one due to its urgency, but code review and QA would be helpful nonetheless - we can follow up with any adjustments needed

Copy link
Collaborator

@michelle0927 michelle0927 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went ahead and reviewed this because it didn't have a reviewer assigned. Found one small issue.

}
$.export("$summary", `Successfully retrieved block${this.retrieveChildren
? ` with ${block.children.length ?? 0} children`
$.export("$summary", `Successfully retrieved block${retrieveChildren
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line gets an error when retrieveChildren is set to None. Should add && retrieveChildren !== "None":

$.export("$summary", Successfully retrieved block${retrieveChildren && retrieveChildren !== "None"`

@michelle0927 michelle0927 moved this from Ready for PR Review to Changes Required in Component (Source and Action) Backlog Apr 10, 2025
@michelle0927 michelle0927 moved this from Changes Required to Done in Component (Source and Action) Backlog Apr 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants