-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Hubspot - add widget props #18347
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
base: master
Are you sure you want to change the base?
Hubspot - add widget props #18347
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
WalkthroughAdds optional Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant Action as Create/Update Action
participant Parser as parseObject
participant HS as HubSpot CMS API
User->>Action: invoke action (page inputs ...)
rect rgba(200,230,255,0.25)
note right of Action: New/changed payload fields
Action->>Parser: parseObject(this.widgetContainers)
Parser-->>Action: widgetContainers (object)
Action->>Parser: parseObject(this.widgets)
Parser-->>Action: widgets (object)
end
Action->>HS: POST/PATCH payload { ..., widgetContainers, widgets, ... }
HS-->>Action: response (created/updated resource)
Action-->>User: return result (summary, data)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ 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)
Pre-merge checks (3 passed, 2 warnings)❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests
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. Comment |
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
🧹 Nitpick comments (6)
components/hubspot/actions/list-pages/list-pages.mjs (1)
108-113
: Avoid a no-op extra loop iteration at maxResults.Set hasMore = false before breaking the inner loop.
Apply this diff:
count++; if (count >= this.maxResults) { - break; + hasMore = false; + break; }components/hubspot/actions/common/common-page-prop.mjs (1)
79-90
: Add explicit guidance that HubSpot requires full widget definitions.Tighten descriptions so users know partial updates aren’t supported.
Apply this diff:
widgetContainers: { type: "object", label: "Widget Containers", - description: "A data structure containing the data for all the modules inside the containers for this page", + description: "JSON for all modules inside containers on this page. Provide full definitions; HubSpot does not support partial widget updates.", optional: true, }, widgets: { type: "object", label: "Widgets", - description: "A data structure containing the data for all the modules for this page", + description: "JSON for all modules on this page (outside containers). Provide full definitions; HubSpot does not support partial widget updates.", optional: true, },components/hubspot/actions/update-landing-page/update-landing-page.mjs (1)
56-58
: Only include widget fields when provided to avoid undefined keys.Prevents sending undefined and keeps payload minimal.
Apply this diff:
templatePath: this.templatePath, - widgetContainers: parseObject(this.widgetContainers), - widgets: parseObject(this.widgets), + ...(this.widgetContainers !== undefined + ? { widgetContainers: parseObject(this.widgetContainers) } + : {}), + ...(this.widgets !== undefined + ? { widgets: parseObject(this.widgets) } + : {}),components/hubspot/actions/create-page/create-page.mjs (1)
39-41
: Only include widget fields when provided to avoid undefined keys.Apply this diff:
templatePath: this.templatePath, - widgetContainers: parseObject(this.widgetContainers), - widgets: parseObject(this.widgets), + ...(this.widgetContainers !== undefined + ? { widgetContainers: parseObject(this.widgetContainers) } + : {}), + ...(this.widgets !== undefined + ? { widgets: parseObject(this.widgets) } + : {}),components/hubspot/actions/create-landing-page/create-landing-page.mjs (1)
47-49
: Only include widget fields when provided to avoid undefined keys.Apply this diff:
templatePath: this.templatePath, - widgetContainers: parseObject(this.widgetContainers), - widgets: parseObject(this.widgets), + ...(this.widgetContainers !== undefined + ? { widgetContainers: parseObject(this.widgetContainers) } + : {}), + ...(this.widgets !== undefined + ? { widgets: parseObject(this.widgets) } + : {}),components/hubspot/actions/update-page/update-page.mjs (1)
48-50
: Only include widget fields when provided to avoid undefined keys.Apply this diff:
templatePath: this.templatePath, - widgetContainers: parseObject(this.widgetContainers), - widgets: parseObject(this.widgets), + ...(this.widgetContainers !== undefined + ? { widgetContainers: parseObject(this.widgetContainers) } + : {}), + ...(this.widgets !== undefined + ? { widgets: parseObject(this.widgets) } + : {}),
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
components/hubspot/actions/common/common-page-prop.mjs
(1 hunks)components/hubspot/actions/create-landing-page/create-landing-page.mjs
(2 hunks)components/hubspot/actions/create-page/create-page.mjs
(2 hunks)components/hubspot/actions/list-pages/list-pages.mjs
(4 hunks)components/hubspot/actions/update-landing-page/update-landing-page.mjs
(2 hunks)components/hubspot/actions/update-page/update-page.mjs
(2 hunks)components/hubspot/package.json
(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (4)
components/hubspot/actions/create-page/create-page.mjs (1)
components/hubspot/common/utils.mjs (2)
parseObject
(1-25)parseObject
(1-25)
components/hubspot/actions/create-landing-page/create-landing-page.mjs (1)
components/hubspot/common/utils.mjs (2)
parseObject
(1-25)parseObject
(1-25)
components/hubspot/actions/update-landing-page/update-landing-page.mjs (1)
components/hubspot/common/utils.mjs (2)
parseObject
(1-25)parseObject
(1-25)
components/hubspot/actions/update-page/update-page.mjs (1)
components/hubspot/common/utils.mjs (2)
parseObject
(1-25)parseObject
(1-25)
🔇 Additional comments (7)
components/hubspot/package.json (1)
3-3
: Patch bump looks right.Aligns with action version bumps in this PR.
components/hubspot/actions/list-pages/list-pages.mjs (1)
8-8
: Rename to pages + version bump — LGTM.Naming is clearer and summary matches the return value.
Also applies to: 82-82, 108-108, 120-124, 124-124
components/hubspot/actions/common/common-page-prop.mjs (1)
79-90
: Confirmed — CMS Pages v3 expects camelCasewidgets
andwidgetContainers
; include the full object when updating modules.Neither field is universally required; include the full
widgets
object for top-level template modules or the fullwidgetContainers
object for modules inside containers. Partial merges aren't supported — omitting the full object will overwrite/clear draft data.File: components/hubspot/actions/common/common-page-prop.mjs (lines 79–90): property names are correct.
components/hubspot/actions/update-landing-page/update-landing-page.mjs (1)
10-10
: Version bump — LGTM.components/hubspot/actions/create-page/create-page.mjs (1)
10-10
: Version bump — LGTM.components/hubspot/actions/create-landing-page/create-landing-page.mjs (1)
10-10
: Version bump — LGTM.components/hubspot/actions/update-page/update-page.mjs (1)
10-10
: Version bump — LGTM.
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 @michelle0927. I just added a minor suggestion.
Resolves #18300
Resolves #18306
Summary by CodeRabbit