Skip to content
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 Update Page Dynamic Fields #15002

Merged
merged 4 commits into from
Dec 19, 2024
Merged

Notion Update Page Dynamic Fields #15002

merged 4 commits into from
Dec 19, 2024

Conversation

michelle0927
Copy link
Collaborator

@michelle0927 michelle0927 commented Dec 16, 2024

Resolves #14905

Summary by CodeRabbit

  • New Features

    • Enhanced property filtering and value assignment in the page builder.
    • Improved error handling in the update page action.
  • Bug Fixes

    • Resolved potential errors in property retrieval and formatting.
  • Documentation

    • Updated descriptions for clarity across multiple components.
  • Chores

    • Incremented version numbers for various components and the package.

Copy link

vercel bot commented Dec 16, 2024

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 Dec 18, 2024 8:22pm
pipedream-docs ⬜️ Ignored (Inspect) Dec 18, 2024 8:22pm
pipedream-docs-redirect-do-not-edit ⬜️ Ignored (Inspect) Dec 18, 2024 8:22pm

Copy link
Contributor

coderabbitai bot commented Dec 16, 2024

Walkthrough

This pull request involves several minor updates across the Notion integration components. The changes primarily focus on version increments and slight description modifications in various files such as append-block.mjs, create-page-from-database.mjs, duplicate-page.mjs, and update-page.mjs. The update-page.mjs file also includes enhanced error handling for property retrieval and parsing. The package version in package.json was correspondingly updated to reflect these changes.

Changes

File Change Summary
components/notion/actions/append-block/append-block.mjs Version updated from "0.2.16" to "0.2.17"
components/notion/actions/common/base-page-builder.mjs Enhanced _filterProps method to support properties from this.properties
components/notion/actions/create-page-from-database/create-page-from-database.mjs Version updated to "0.1.15", description wording changed
components/notion/actions/create-page/create-page.mjs Version updated from "0.2.12" to "0.2.13"
components/notion/actions/duplicate-page/duplicate-page.mjs Version updated to "0.0.9", description modified
components/notion/actions/update-page/update-page.mjs Version updated to "1.1.3", added error handling for properties
components/notion/package.json Version updated from "0.2.6" to "0.2.7"

Assessment against linked issues

Objective Addressed Explanation
Dynamic variable support for Notion Update Page Partial improvements in error handling, but unclear if fully resolves dynamic field population issue

Possibly related PRs

Suggested reviewers

  • jcortes

Poem

🐰 A Notion of Change, Hop Hop Hooray!
Versions dancing, a software ballet
Properties filtered with magical grace
Errors caught in a gentle embrace
Code hops forward, one version at a time! 🚀


📜 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 cc13504 and 7655450.

📒 Files selected for processing (1)
  • components/notion/actions/update-page/update-page.mjs (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • components/notion/actions/update-page/update-page.mjs

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?

❤️ 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 resolve resolve all the CodeRabbit review comments.
  • @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.

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: 1

🧹 Nitpick comments (2)
components/notion/actions/update-page/update-page.mjs (1)

57-73: Consider adding error logging in the catch block.

The addition of error handling for database property retrieval is a good improvement. However, it would be valuable to log the error for debugging purposes.

    try {
      const { properties } = await this.notion.retrieveDatabase(this.parent);
      const selectedProperties = pick(properties, this.propertyTypes);

      return this.buildAdditionalProps({
        properties: selectedProperties,
        meta: this.metaTypes,
      });
-    } catch {
+    } catch (error) {
+      console.error('Failed to retrieve database properties:', error);
      return {
        properties: {
          type: "object",
          label: "Properties",
          description: "Enter the page properties as a JSON object",
        },
      };
    }
components/notion/actions/common/base-page-builder.mjs (1)

82-87: Optimize property access with optional chaining.

The property filtering enhancement is good, but we can improve the code readability using optional chaining.

-        .filter((property) => this[property] != null
-          || (this.properties && this.properties[property]))
+        .filter((property) => this[property] != null
+          || this.properties?.[property])
        .map((property) => ({
          type: properties[property]?.type ?? property,
          label: property,
-          value: this[property] || this.properties[property],
+          value: this[property] ?? this.properties?.[property],
        }));

Note: Changed || to ?? in the value assignment to properly handle falsy values.

🧰 Tools
🪛 Biome (1.9.4)

[error] 83-83: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 9c2e2e9 and cc13504.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (7)
  • components/notion/actions/append-block/append-block.mjs (1 hunks)
  • components/notion/actions/common/base-page-builder.mjs (1 hunks)
  • components/notion/actions/create-page-from-database/create-page-from-database.mjs (1 hunks)
  • components/notion/actions/create-page/create-page.mjs (1 hunks)
  • components/notion/actions/duplicate-page/duplicate-page.mjs (1 hunks)
  • components/notion/actions/update-page/update-page.mjs (3 hunks)
  • components/notion/package.json (1 hunks)
✅ Files skipped from review due to trivial changes (5)
  • components/notion/package.json
  • components/notion/actions/append-block/append-block.mjs
  • components/notion/actions/create-page-from-database/create-page-from-database.mjs
  • components/notion/actions/create-page/create-page.mjs
  • components/notion/actions/duplicate-page/duplicate-page.mjs
🧰 Additional context used
🪛 Biome (1.9.4)
components/notion/actions/common/base-page-builder.mjs

[error] 83-83: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

🔇 Additional comments (1)
components/notion/actions/update-page/update-page.mjs (1)

9-10: LGTM! Version bump and documentation update are appropriate.

The version increment and documentation wording changes are consistent with the nature of the updates in this PR.

jcortes
jcortes previously approved these changes Dec 17, 2024
Copy link
Collaborator

@jcortes jcortes left a 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!

@vunguyenhung
Copy link
Collaborator

Hi @michelle0927, I tested with the new version, but I still see the data not updated. Could you check again?

@michelle0927
Copy link
Collaborator Author

/approve

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Notion Update Page Dynamic Fields
3 participants