Skip to content

Adding support for oauthAppId in connect-react #17116

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

dannyroosevelt
Copy link
Collaborator

@dannyroosevelt dannyroosevelt commented Jun 13, 2025

And patching Discord sentViaPipedream prop label and handling

WHY

Summary by CodeRabbit

  • New Features

    • Added support for specifying a custom OAuth app ID in React component forms, enabling app-specific account connections.
    • Introduced new context and hooks for managing OAuth app identifiers within React components.
  • Improvements

    • Updated labels and descriptions for Discord integration options to clarify link destinations.
    • Conditional display of Pipedream links in Discord messages based on environment configuration.
    • Enhanced documentation with new OAuth configuration instructions and updated prop usage examples.
  • Bug Fixes

    • Corrected prop naming and improved alignment with expected conventions in React components.
  • Chores

    • Incremented version numbers for Discord actions, sources, and packages to reflect recent updates.

And patching Discord sentViaPipedream prop label and handling
Copy link

vercel bot commented Jun 13, 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 Jun 13, 2025 8:02pm
pipedream-docs ⬜️ Ignored (Inspect) Jun 13, 2025 8:02pm
pipedream-docs-redirect-do-not-edit ⬜️ Ignored (Inspect) Jun 13, 2025 8:02pm

Copy link
Contributor

coderabbitai bot commented Jun 13, 2025

Warning

Rate limit exceeded

@dannyroosevelt has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 8 minutes and 59 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between c07582d and f131246.

📒 Files selected for processing (16)
  • components/discord/actions/common/common.mjs (1 hunks)
  • components/slack/actions/common/send-message.mjs (1 hunks)
  • components/slack/actions/reply-to-a-message/reply-to-a-message.mjs (1 hunks)
  • components/slack/actions/send-block-kit-message/send-block-kit-message.mjs (1 hunks)
  • components/slack/actions/send-large-message/send-large-message.mjs (1 hunks)
  • components/slack/actions/send-message-advanced/send-message-advanced.mjs (1 hunks)
  • components/slack/actions/send-message-to-channel/send-message-to-channel.mjs (1 hunks)
  • components/slack/actions/send-message-to-user-or-group/send-message-to-user-or-group.mjs (1 hunks)
  • components/slack/actions/send-message/send-message.mjs (1 hunks)
  • components/slack/package.json (1 hunks)
  • packages/connect-react/CHANGELOG.md (1 hunks)
  • packages/connect-react/README.md (4 hunks)
  • packages/connect-react/package.json (1 hunks)
  • packages/connect-react/src/components/ComponentForm.tsx (2 hunks)
  • packages/connect-react/src/components/ComponentFormContainer.tsx (1 hunks)
  • packages/connect-react/src/hooks/oauth-app-context.tsx (1 hunks)

Walkthrough

This update introduces conditional link generation in Discord action messages based on the presence of a workflow ID, updates property labels and descriptions for clarity, and increments version numbers across Discord components and sources. In the connect-react package, OAuth app context support is added, enabling custom OAuth client IDs, with corresponding prop and documentation updates.

Changes

File(s) Change Summary
components/discord/actions/common/common.mjs Modified getSentViaPipedreamText to return different link text/URL based on PIPEDREAM_WORKFLOW_ID presence.
components/discord/discord.app.mjs Updated includeSentViaPipedream label and description for clarity.
components/discord/actions/send-message-advanced/send-message-advanced.mjs
components/discord/actions/send-message/send-message.mjs
components/discord/actions/send-message-with-file/send-message-with-file.mjs
components/discord/sources/message-deleted/message-deleted.mjs
components/discord/sources/new-command-received/new-command-received.mjs
components/discord/sources/new-guild-member/new-guild-member.mjs
components/discord/sources/new-message/new-message.mjs
components/discord/sources/reaction-added/reaction-added.mjs
Incremented version numbers in Discord actions and sources.
components/discord/package.json Updated package version from 1.2.4 to 1.2.5.
packages/connect-react/README.md Documented new oauthAppId prop, renamed userId to externalUserId, made several props optional, and updated usage examples.
packages/connect-react/CHANGELOG.md Added changelog entry for version 1.3.1, describing OAuth app support and prop changes.
packages/connect-react/package.json Updated package version from 1.3.0 to 1.3.1.
packages/connect-react/src/components/ComponentForm.tsx Added optional oauthAppId prop, wrapped form in OAuthAppProvider.
packages/connect-react/src/components/ControlApp.tsx Used useOAuthAppContext for oauthAppId, updated hook parameter names.
packages/connect-react/src/components/ComponentFormContainer.tsx Omitted componentKey prop when passing props to ComponentForm.
packages/connect-react/src/hooks/oauth-app-context.tsx Introduced OAuth app context provider and hook.
packages/connect-react/src/index.ts Exported OAuth app context hooks from module index.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ComponentForm
    participant OAuthAppProvider
    participant ControlApp
    participant useOAuthAppContext

    User->>ComponentForm: Render with props (including oauthAppId)
    ComponentForm->>OAuthAppProvider: Wrap children, provide oauthAppId
    OAuthAppProvider->>ControlApp: Render children
    ControlApp->>useOAuthAppContext: Retrieve oauthAppId from context
    useOAuthAppContext-->>ControlApp: Return oauthAppId
    ControlApp->>ControlApp: Use oauthAppId in account connection logic
Loading

Poem

In Discord’s den, a subtle tweak,
Links now shift, unique each week.
OAuth bunnies hop with glee,
New props and docs for all to see.
Versions leap—no time to nap!
🐇✨ Code hops forward, tap by tap.

✨ Finishing Touches
  • 📝 Generate Docstrings

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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate sequence diagram to generate a sequence diagram of the changes in this 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

🔭 Outside diff range comments (1)
components/discord/actions/common/common.mjs (1)

6-10: 🛠️ Refactor suggestion

Missing label / description on channel prop – breaks Pipedream lint checks

The CI warning you’re seeing comes from these two required fields:

 channel: {
   type: "$.discord.channel",
   appProp: "discord",
+  label: "Channel",
+  description: "Discord channel where the message will be posted",
 },
🧰 Tools
🪛 GitHub Check: Lint Code Base

[warning] 7-7:
Component prop channel must have a description. See https://pipedream.com/docs/components/guidelines/#props


[warning] 7-7:
Component prop channel must have a label. See https://pipedream.com/docs/components/guidelines/#props

🪛 GitHub Actions: Pull Request Checks

[warning] 7-7: Component prop channel must have a label. See https://pipedream.com/docs/components/guidelines/#props (pipedream/props-label)


[warning] 7-7: Component prop channel must have a description. See https://pipedream.com/docs/components/guidelines/#props (pipedream/props-description)

🧹 Nitpick comments (5)
components/discord/actions/common/common.mjs (1)

60-66: Potential 2 000-char overflow when appending attribution

Discord hard-limits message content to 2 000 characters.
appendPipedreamText tacks on a newline + attribution without guarding against overflow, so longer user messages will error.

Option: truncate or throw when content.length > 1990 before appending.

components/discord/package.json (1)

3-3: Remember to update the CHANGELOG when publishing 1.2.5
Pure version bump acknowledged.

packages/connect-react/package.json (1)

3-3: Consider bumping minor version for new feature

Adding the public oauthAppId prop constitutes new functionality rather than a pure fix, so semver would normally call for 1.4.0 instead of 1.3.1. This signals to consumers that new capability is available.

packages/connect-react/src/components/InternalField.tsx (1)

44-47: Avoid emitting undefined keys in extra

extra: { app, oauthAppId } sends oauthAppId: undefined when the prop isn’t set.
Not harmful, but for tidiness you could omit the key when undefined:

-      oauthAppId,
+      ...(oauthAppId ? { oauthAppId } : {}),
packages/connect-react/src/components/ControlApp.tsx (1)

26-32: Fix eslint object-curly-newline violation

Current formatting violates the repo lint rule, causing the pipeline failure. Apply:

-export function ControlApp({ app, oauthAppId }: ControlAppProps) {
+export function ControlApp({
+  app,
+  oauthAppId,
+}: ControlAppProps) {
🧰 Tools
🪛 GitHub Check: Lint Code Base

[failure] 31-31:
Expected a line break before this closing brace


[failure] 31-31:
Expected a line break after this opening brace

🪛 GitHub Actions: Pull Request Checks

[error] 31-31: Expected a line break after this opening brace (object-curly-newline)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 91e6abc and 264b10a.

📒 Files selected for processing (14)
  • components/discord/actions/common/common.mjs (1 hunks)
  • components/discord/actions/send-message-advanced/send-message-advanced.mjs (1 hunks)
  • components/discord/actions/send-message-with-file/send-message-with-file.mjs (1 hunks)
  • components/discord/actions/send-message/send-message.mjs (1 hunks)
  • components/discord/discord.app.mjs (1 hunks)
  • components/discord/package.json (1 hunks)
  • packages/connect-react/CHANGELOG.md (1 hunks)
  • packages/connect-react/package.json (1 hunks)
  • packages/connect-react/src/components/ComponentForm.tsx (1 hunks)
  • packages/connect-react/src/components/Control.tsx (1 hunks)
  • packages/connect-react/src/components/ControlApp.tsx (2 hunks)
  • packages/connect-react/src/components/InternalField.tsx (2 hunks)
  • packages/connect-react/src/hooks/form-context.tsx (3 hunks)
  • packages/connect-react/src/hooks/form-field-context.tsx (1 hunks)
🧰 Additional context used
🪛 GitHub Actions: Pull Request Checks
components/discord/actions/common/common.mjs

[warning] 7-7: Component prop channel must have a label. See https://pipedream.com/docs/components/guidelines/#props (pipedream/props-label)


[warning] 7-7: Component prop channel must have a description. See https://pipedream.com/docs/components/guidelines/#props (pipedream/props-description)

packages/connect-react/src/components/ControlApp.tsx

[error] 31-31: Expected a line break after this opening brace (object-curly-newline)

packages/connect-react/CHANGELOG.md

[warning] 1-1: File ignored because of a matching ignore pattern. Use "--no-ignore" to disable file ignore settings or use "--no-warn-ignored" to suppress this warning

🪛 GitHub Check: Lint Code Base
packages/connect-react/src/components/ControlApp.tsx

[failure] 31-31:
Expected a line break before this closing brace


[failure] 31-31:
Expected a line break after this opening brace

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Verify TypeScript components
  • GitHub Check: Publish TypeScript components
🔇 Additional comments (11)
components/discord/discord.app.mjs (1)

14-16: Docstring still accurate after logic change – LGTM
The new label / description now mirror the conditional link generation. No further action needed.

components/discord/actions/send-message/send-message.mjs (1)

24-27: message is required – safe call, LGTM
message is mandatory in this action, so calling appendPipedreamText(message) can’t raise on undefined. Good.

components/discord/actions/send-message-with-file/send-message-with-file.mjs (1)

65-67: Nil-coalescing guard is correct – LGTM
Using message ?? "" avoids passing undefined to appendPipedreamText. Looks good.

components/discord/actions/send-message-advanced/send-message-advanced.mjs (1)

9-9: Version Bump: Update action version to 1.0.3

Aligns with coordinated version updates across Discord actions. No functional changes introduced.

packages/connect-react/src/components/ComponentForm.tsx (1)

32-35: Prop addition is cleanly integrated

JSDoc and typing look correct; the field is optional so no breaking change is introduced.

packages/connect-react/src/components/InternalField.tsx (1)

18-20: Destructuring preserves backwards compatibility

Forwarding oauthAppId through context without modifying existing signatures keeps the change safe and non-breaking.

packages/connect-react/src/components/Control.tsx (1)

77-77: Ensure ControlApp prop typings include oauthAppId?

The value is wired through correctly, but please verify ControlApp’s prop interface marks oauthAppId as optional to avoid TypeScript errors when it’s absent.

packages/connect-react/src/hooks/form-field-context.tsx (1)

10-11: Context extension looks accurate

Limiting oauthAppId to ConfigurablePropApp keeps the extra data scoped to app fields—nice touch.

packages/connect-react/CHANGELOG.md (1)

5-23: Changelog entry looks good

Version bump, description, and usage example are all clear and consistent with the code changes. 👍

packages/connect-react/src/hooks/form-context.tsx (1)

43-48: oauthAppId correctly threaded through context

The new oauthAppId field is (1) added to the FormContext type, (2) pulled from formProps, and (3) injected into the provider value. Nothing else in this file depends on it, so no additional dependency-array updates are needed.
Looks correct. ⚙️

Also applies to: 84-86, 597-598

packages/connect-react/src/components/ControlApp.tsx (1)

78-82:

✅ Verification successful

Verify param rename from externalUserIdexternal_user_id

useAccounts now expects external_user_id. Ensure every other call site was updated, otherwise queries may silently fail.


🏁 Script executed:

#!/bin/bash
# Search remaining call-sites for the old camelCase key.
rg -n $'externalUserId:' --type ts,tsx

Length of output: 68


🏁 Script executed:

#!/bin/bash
# Search for remaining call-sites for the old camelCase key in TS/TSX files
rg -n 'externalUserId' --glob '*.ts' --glob '*.tsx'

Length of output: 7905


#!/bin/bash
# Locate all useAccounts hook invocations within connect-react
rg -n "useAccounts" --glob "packages/connect-react/src/**/*.tsx"

# Check for external_user_id usage across connect-react components
rg -n "external_user_id" --glob "packages/connect-react/src/**/*.{ts,tsx}"

🏁 Script executed:

#!/bin/bash
# Search for useAccounts invocations in connect-react
rg -n "useAccounts" --glob 'packages/connect-react/src/**/*.{ts,tsx}'

# Search for external_user_id usage in connect-react components
rg -n "external_user_id" --glob 'packages/connect-react/src/**/*.{ts,tsx}'

Length of output: 505


External_user_id rename in useAccounts verified

Searched for useAccounts invocations in packages/connect-react and confirmed the only call site in ControlApp.tsx was updated to use external_user_id. No remaining externalUserId call sites exist in this package.

• Updated location: packages/connect-react/src/components/ControlApp.tsx:78

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)
packages/connect-react/src/components/ComponentFormContainer.tsx (1)

14-26: Do the componentKey presence check before calling useComponent

useComponent is executed even when componentKey is empty / undefined, which may trigger an unnecessary network request (and possibly internal errors) before we throw.
Moving the guard above the hook keeps the call order deterministic while preventing useless work:

 export function ComponentFormContainer<T extends ConfigurableProps>(props: ComponentFormContainerProps<T>) {
-  const {
+  if (!props.componentKey) {
+    throw new Error("componentKey required");
+  }
+
+  const {
     isLoading,
     error,
     component,
   } = useComponent({
     key: props.componentKey,
   });
-  if (!props.componentKey) {
-    throw new Error("componentKey required");
-  }
packages/connect-react/README.md (3)

96-105: Snippet mixes userId variable name with new externalUserId prop

The example keeps the local variable named userId but passes it to externalUserId.
Renaming the variable avoids cognitive friction:

-  const userId = "my-authed-user-id";
+  const externalUserId = "my-authed-user-id";
 ...
-        <ComponentFormContainer
-          externalUserId={userId}
+        <ComponentFormContainer
+          externalUserId={externalUserId}

137-160: Prop table: clarify new “optional” semantics

onSubmit, onUpdateConfiguredProps, hideOptionalProps, and sdkResponse are now marked optional, but the docs don’t explain the behavioural change (e.g., is the submit button suppressed when onSubmit is omitted?).
A one-liner per prop describing what happens when it’s undefined would eliminate guesswork.


191-197: Consistency nit – same variable name issue in customization snippet

As above, the snippet still uses userId while the prop is externalUserId. Aligning names keeps the examples consistent.

-      externalUserId={userId}
+      externalUserId={externalUserId}
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 264b10a and c07582d.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (11)
  • components/discord/sources/message-deleted/message-deleted.mjs (1 hunks)
  • components/discord/sources/new-command-received/new-command-received.mjs (1 hunks)
  • components/discord/sources/new-guild-member/new-guild-member.mjs (1 hunks)
  • components/discord/sources/new-message/new-message.mjs (1 hunks)
  • components/discord/sources/reaction-added/reaction-added.mjs (1 hunks)
  • packages/connect-react/README.md (3 hunks)
  • packages/connect-react/src/components/ComponentForm.tsx (2 hunks)
  • packages/connect-react/src/components/ComponentFormContainer.tsx (1 hunks)
  • packages/connect-react/src/components/ControlApp.tsx (3 hunks)
  • packages/connect-react/src/hooks/oauth-app-context.tsx (1 hunks)
  • packages/connect-react/src/index.ts (1 hunks)
✅ Files skipped from review due to trivial changes (7)
  • components/discord/sources/message-deleted/message-deleted.mjs
  • components/discord/sources/new-message/new-message.mjs
  • packages/connect-react/src/index.ts
  • components/discord/sources/reaction-added/reaction-added.mjs
  • components/discord/sources/new-guild-member/new-guild-member.mjs
  • components/discord/sources/new-command-received/new-command-received.mjs
  • packages/connect-react/src/hooks/oauth-app-context.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/connect-react/src/components/ControlApp.tsx
  • packages/connect-react/src/components/ComponentForm.tsx
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: pnpm publish
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Verify TypeScript components
  • GitHub Check: Lint Code Base
🔇 Additional comments (1)
packages/connect-react/src/components/ComponentFormContainer.tsx (1)

40-41: componentKey is now correctly omitted

Nice tidy-up – removing componentKey from the spread prevents React from complaining about an unknown prop on ComponentForm.

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.

1 participant