Skip to content

Conversation

@GTFalcao
Copy link
Collaborator

@GTFalcao GTFalcao commented Sep 25, 2025

These actions only show additional props that were selected in "propertyGroups", so calling reloadProps in the app file (when propertyGroups has not been selected yet) is irrelevant

Summary by CodeRabbit

  • New Features

    • Added a helper to retrieve the selected custom object type in the “Create Custom Object” action.
  • Refactor

    • Standardized HubSpot app configuration across create/update actions for companies, contacts, deals, leads, tickets, and custom objects, improving consistency and maintainability.
  • Chores

    • Bumped versions for multiple HubSpot actions and the HubSpot package to reflect updates.

Removing reloadProps from the app file for actions for which this is irrelevant
@vercel
Copy link

vercel bot commented Sep 25, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
pipedream-docs Ignored Ignored Sep 25, 2025 8:05pm
pipedream-docs-redirect-do-not-edit Ignored Ignored Sep 25, 2025 8:05pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 25, 2025

Walkthrough

Refactors HubSpot actions to use a direct hubspot prop instead of appProp.props, updates propDefinitions accordingly, and adjusts common create logic to call methods via this.hubspot. Adds getObjectType in create-custom-object. Multiple action files increment version strings. Bumps package version in components/hubspot/package.json.

Changes

Cohort / File(s) Summary of Changes
HubSpot props refactor
components/hubspot/actions/common/common-create-object.mjs, components/hubspot/actions/create-custom-object/create-custom-object.mjs, components/hubspot/actions/create-lead/create-lead.mjs, components/hubspot/actions/update-company/update-company.mjs, components/hubspot/actions/update-contact/update-contact.mjs, components/hubspot/actions/update-custom-object/update-custom-object.mjs, components/hubspot/actions/update-deal/update-deal.mjs, components/hubspot/actions/update-lead/update-lead.mjs
Replace appProp usage with direct hubspot prop; update propDefinition references to hubspot; in common-create-object call this.hubspot.createObject and access helpers via hubspot; in create-custom-object/use-lead destructure { hubspot, ...otherProps } and spread otherProps.
Method addition
components/hubspot/actions/create-custom-object/create-custom-object.mjs
Add getObjectType() returning this.customObjectType; bump version to 1.0.12; adopt hubspot prop and otherProps.
Version bumps only
components/hubspot/actions/create-company/create-company.mjs, components/hubspot/actions/create-deal/create-deal.mjs, components/hubspot/actions/create-or-update-contact/create-or-update-contact.mjs, components/hubspot/actions/create-ticket/create-ticket.mjs
Increment version strings; no logic changes.
Package version
components/hubspot/package.json
Bump package version from 1.7.10 to 1.7.11.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant Action as Action (Create/Update)
  participant HSApp as HubSpot App (hubspot prop)
  participant API as HubSpot API

  User->>Action: Trigger run()
  Note over Action: Access props via `hubspot`<br/>Resolve object type/id
  Action->>HSApp: createObject / updateObject(props)
  HSApp->>API: REST call with payload
  API-->>HSApp: Response (success/error)
  HSApp-->>Action: Result
  Action-->>User: Emit outcome
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

I twitch my ears at tidy props,
hop-hop—no more appProp stops!
A hubspot path, direct and bright,
new methods nibble, versions light.
With clean burrows in our codey glen,
we ship, we sip a carrot pen. 🥕🐇

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Title Check ⚠️ Warning The provided title references “reloadProps,” but the diff applies broad refactors to import the hubspot module, update prop references, and bump version numbers across multiple action files without any changes related to reloadProps, making the title misleading and not reflective of the main changes. Rename the pull request to clearly summarize the primary work, for example “Refactor Hubspot action imports and bump versions to use hubspot.app,” so it accurately reflects the refactoring and version updates present in the changes.
Description Check ⚠️ Warning The pull request description does not follow the repository’s required template because it lacks the “## WHY” heading and does not structure content into the specified section, instead providing a standalone sentence without contextual framing. Update the description to include the “## WHY” section header and complete the template by explaining the motivation and context for the changes, ensuring it matches the repository’s description format.
✅ Passed checks (1 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch hubspot-reloadprops-adjustment

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

Comment @coderabbitai help to get the list of available commands and usage tips.

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
components/hubspot/actions/update-custom-object/update-custom-object.mjs (1)

19-34: Replace remaining appProp references and audit reloadProps

  • components/hubspot/actions/common/common-create.mjs: drop the import appProp and spread of appProp.props, reference hubspot directly.
  • components/hubspot/actions/create-communication/create-communication.mjs: replace appProp.props.hubspot with hubspot and remove the appProp import.
  • Audit all reloadProps usages to confirm they’re only set on props that gate downstream options.
🧹 Nitpick comments (5)
components/hubspot/actions/common/common-create-object.mjs (2)

48-59: Avoid name shadowing of hubspot; use this.hubspot consistently.

Reduces confusion between the imported prop def and the runtime instance.

Apply:

@@
   async run({ $ }) {
     const {
-      hubspot,
       /* eslint-disable no-unused-vars */
 
       propertyGroups,
       customObjectType,
       contactId,
       $db,
       updateIfExists,
       objectProperties,
       ...otherProperties
     } = this;
@@
-      const objectName = hubspot.getObjectTypeName(objectType);
+      const objectName = this.hubspot.getObjectTypeName(objectType);
       $.export("$summary", `Successfully created ${objectName}`);
@@
-          const response = await hubspot.updateObject({
+          const response = await this.hubspot.updateObject({
             $,
             objectType,
             objectId,
             data: {
               properties,
             },
           });
-          const objectName = hubspot.getObjectTypeName(objectType);
+          const objectName = this.hubspot.getObjectTypeName(objectType);
           $.export("$summary", `Successfully updated ${objectName}`);

Also applies to: 85-86, 94-101, 102-104


89-107: Harden error parsing and guard objectId extraction in update-on-conflict path.

Avoids losing the original error on non‑JSON messages and prevents invalid update calls.

Apply:

-      if (updateIfExists && err?.message) {
-        const errorObj = JSON.parse(err?.message);
-        if (errorObj?.category === "CONFLICT" || errorObj?.category === "OBJECT_ALREADY_EXISTS") {
-          const objectId = parseInt(errorObj.message.replace(/[^\d]/g, ""));
-          const response = await this.hubspot.updateObject({
+      if (updateIfExists && err?.message) {
+        try {
+          const errorObj = JSON.parse(err.message);
+          const isConflict = ["CONFLICT", "OBJECT_ALREADY_EXISTS"].includes(errorObj?.category);
+          const objectIdFromMsg = parseInt(String(errorObj?.message || "").replace(/[^\d]/g, ""), 10);
+          const objectId = Number.isFinite(objectIdFromMsg) ? objectIdFromMsg : undefined;
+          if (isConflict && objectId) {
+            const response = await this.hubspot.updateObject({
               $,
               objectType,
               objectId,
               data: {
                 properties,
               },
             });
-          const objectName = this.hubspot.getObjectTypeName(objectType);
-          $.export("$summary", `Successfully updated ${objectName}`);
-          return response;
-        }
+            const objectName = this.hubspot.getObjectTypeName(objectType);
+            $.export("$summary", `Successfully updated ${objectName}`);
+            return response;
+          }
+        } catch (_) {
+          // fall through to throw original error
+        }
       }
components/hubspot/actions/create-ticket/create-ticket.mjs (1)

20-33: Align propDefinition to the new hubspot prop pattern.

Other updated actions now pass the local hubspot prop (not common.props.hubspot) to propDefinition. For consistency and to simplify future refactors, adopt the same pattern used in create-lead.

Example pattern (outside this range):

  • Destructure once:
    const { hubspot, ...otherProps } = common.props
  • In props:
    props: { hubspot, ...otherProps, ... }
  • Then update:
    propDefinition: [hubspot, "ticketPipeline"]
    propDefinition: [hubspot, "ticketStage", (c) => ({ pipelineId: c.hs_pipeline }))
components/hubspot/actions/update-contact/update-contact.mjs (1)

20-29: Use the existing constant instead of a string for objectType

For consistency and to avoid magic strings, prefer OBJECT_TYPE.CONTACT in the objectId propDefinition.

Apply:

       propDefinition: [
         hubspot,
         "objectId",
-        () => ({
-          objectType: "contact",
-        }),
+        () => ({
+          objectType: OBJECT_TYPE.CONTACT,
+        }),
       ],
components/hubspot/actions/create-custom-object/create-custom-object.mjs (1)

16-24: Props arrangement looks good; minor consistency note

  • Including hubspot before ...otherProps avoids collisions.
  • Optional: for cross-file consistency, consider standardizing on one pattern (destructuring from common.props vs. direct hubspot import) across HubSpot actions in a follow-up sweep.
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 214e592 and 0eaf692.

📒 Files selected for processing (13)
  • components/hubspot/actions/common/common-create-object.mjs (1 hunks)
  • components/hubspot/actions/create-company/create-company.mjs (1 hunks)
  • components/hubspot/actions/create-custom-object/create-custom-object.mjs (1 hunks)
  • components/hubspot/actions/create-deal/create-deal.mjs (1 hunks)
  • components/hubspot/actions/create-lead/create-lead.mjs (2 hunks)
  • components/hubspot/actions/create-or-update-contact/create-or-update-contact.mjs (1 hunks)
  • components/hubspot/actions/create-ticket/create-ticket.mjs (1 hunks)
  • components/hubspot/actions/update-company/update-company.mjs (3 hunks)
  • components/hubspot/actions/update-contact/update-contact.mjs (3 hunks)
  • components/hubspot/actions/update-custom-object/update-custom-object.mjs (3 hunks)
  • components/hubspot/actions/update-deal/update-deal.mjs (3 hunks)
  • components/hubspot/actions/update-lead/update-lead.mjs (3 hunks)
  • components/hubspot/package.json (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
components/hubspot/actions/create-lead/create-lead.mjs (1)
components/hubspot/actions/create-custom-object/create-custom-object.mjs (1)
  • otherProps (3-5)
components/hubspot/actions/create-custom-object/create-custom-object.mjs (1)
components/hubspot/actions/create-lead/create-lead.mjs (1)
  • otherProps (6-8)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Lint Code Base
  • GitHub Check: Publish TypeScript components
  • GitHub Check: pnpm publish
  • GitHub Check: Verify TypeScript components
🔇 Additional comments (15)
components/hubspot/actions/create-deal/create-deal.mjs (1)

10-10: Version bump looks good.

Consistent with the package bump and other actions in this PR.

components/hubspot/package.json (1)

3-3: Package version bump acknowledged.

Aligned with action version increments.

components/hubspot/actions/create-or-update-contact/create-or-update-contact.mjs (1)

10-10: Version bump looks good.

No functional changes introduced here.

components/hubspot/actions/create-company/create-company.mjs (1)

10-10: Version bump looks good.

In step with related action modules.

components/hubspot/actions/create-ticket/create-ticket.mjs (1)

10-10: Version bump LGTM.

No functional changes here.

components/hubspot/actions/update-deal/update-deal.mjs (1)

2-2: HubSpot prop migration + version bump: LGTM.

hubspot import/prop usage and objectId propDefinition with { objectType: "deal" } are correct and consistent.

Optionally verify consistency with a quick scan (same script as in update-company comment).

Also applies to: 11-11, 20-29

components/hubspot/actions/create-lead/create-lead.mjs (2)

6-8: Destructuring hubspot from common.props: LGTM.

This matches the new standardized pattern used across actions.


16-16: Prop wiring to hubspot + objectId for Contact: LGTM.

propDefinition: [hubspot, "objectId", { objectType: "contact" }] and inclusion of hubspot in props are correct.

Also applies to: 19-31

components/hubspot/actions/update-lead/update-lead.mjs (1)

2-2: HubSpot prop migration + version bump: LGTM
hubspot.app.mjs defines both leadId (line 422) and objectId, so propDefinition: [hubspot, "leadId"] is correct.

components/hubspot/actions/update-custom-object/update-custom-object.mjs (2)

1-1: Direct hubspot app import — LGTM

Switching from appProp to a direct hubspot import aligns with the newer pattern and simplifies prop definitions.


10-10: Version bump acknowledged

Version updated to 1.0.12.

components/hubspot/actions/update-contact/update-contact.mjs (2)

2-2: Direct hubspot app import — LGTM

Consistent with the refactor across actions.


11-11: Version bump acknowledged

Version updated to 0.0.27.

components/hubspot/actions/create-custom-object/create-custom-object.mjs (2)

3-5: Destructuring hubspot from common.props — LGTM

Cleanly avoids duplicating the hubspot prop while reusing the rest of common props.


13-13: Version bump acknowledged

Version updated to 1.0.12.

@GTFalcao GTFalcao removed the request for review from jcortes September 25, 2025 20:43
@GTFalcao GTFalcao moved this from Ready for PR Review to Doing in Component (Source and Action) Backlog Sep 25, 2025
@GTFalcao GTFalcao moved this from Doing to Ready for PR Review in Component (Source and Action) Backlog Sep 25, 2025
@luancazarine luancazarine moved this from Ready for PR Review to In Review in Component (Source and Action) Backlog Sep 25, 2025
Copy link
Collaborator

@luancazarine luancazarine left a comment

Choose a reason for hiding this comment

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

Hi @GTFalcao, LGTM! Ready for QA!

@luancazarine luancazarine moved this from In Review to Ready for QA in Component (Source and Action) Backlog Sep 25, 2025
@vunguyenhung vunguyenhung moved this from Ready for QA to In QA in Component (Source and Action) Backlog Sep 26, 2025
@vunguyenhung vunguyenhung moved this from In QA to Ready for Release in Component (Source and Action) Backlog Sep 26, 2025
@vunguyenhung
Copy link
Collaborator

Hi everyone, all test cases are passed! Ready for release!

Test report
https://vunguyenhung.notion.site/Adjust-hubspot-actions-reloadProps-279bf548bb5e815c86cde46240f087c4

@vunguyenhung vunguyenhung merged commit 732228e into master Sep 26, 2025
10 checks passed
@vunguyenhung vunguyenhung deleted the hubspot-reloadprops-adjustment branch September 26, 2025 07:38
@github-project-automation github-project-automation bot moved this from Ready for Release to Done in Component (Source and Action) Backlog Sep 26, 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