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

Improve Look of SelectApp and SelectComponent #15674

Merged
merged 7 commits into from
Feb 19, 2025

Conversation

jsendo
Copy link
Contributor

@jsendo jsendo commented Feb 19, 2025

WHY

Summary by CodeRabbit

  • Documentation
    • Updated the changelog with details on the latest release.
  • New Features
    • Enhanced the user experience by refining how selections are determined and displayed in the app and component pickers.
  • Bug Fixes
    • Improved the handling of the selected value in the Select component to ensure it accurately reflects the current selection.
  • Chores
    • Upgraded the package version to 1.0.0-preview.30.
    • Introduced a new development script to support continuous build monitoring for improved workflow.

Copy link

vercel bot commented Feb 19, 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 Feb 19, 2025 11:36pm
pipedream-docs ⬜️ Ignored (Inspect) Feb 19, 2025 11:36pm
pipedream-docs-redirect-do-not-edit ⬜️ Ignored (Inspect) Feb 19, 2025 11:36pm

Copy link
Contributor

coderabbitai bot commented Feb 19, 2025

Walkthrough

This PR updates the package version to 1.0.0-preview.30 and documents the changes with a new changelog entry. A new watch script has been added to the package configuration for development builds. The SelectApp and SelectComponent components now compute a derived selectedValue to render the active selection, with minor adjustments made to state update conditions and import statements. Additionally, the useApps hook now returns an empty array by default if no data is found. No changes were made to the public API beyond the version bump.

Changes

File(s) Change Summary
packages/connect-react/CHANGELOG.md, packages/connect-react/package.json Added changelog entry for 1.0.0-preview.30; updated version from preview.29 to preview.30; added new watch script for development builds.
packages/connect-react/.../SelectApp.tsx, packages/connect-react/.../SelectComponent.tsx Modified components to compute and use a selectedValue for the Select prop; introduced conditional state update in input handling; streamlined imports and logic.
packages/connect-react/.../use-apps.tsx Updated the hook to return a default empty array for the apps property when data is undefined.

Possibly related PRs

  • fix(sdk+connect-react): string_options -> stringOptions #14867: The changes in the main PR regarding the SelectApp and SelectComponent components' handling of the value prop are related to the modifications in the retrieved PR that involve renaming string_options to stringOptions, as both involve updates to how values are managed and displayed in components.
  • Biz/dj 2837 show label and keep selected remote option dropdown enabled #15438: The changes in the main PR, specifically in the SelectApp and SelectComponent components, involve the introduction of a selectedValue variable to manage the selected option, which is a similar modification made in the ControlSelect component of the retrieved PR that also alters how the selected value is handled.

Suggested labels

docs, prioritized

Suggested reviewers

  • dylburger
  • jverce

Poem

I hopped through lines of code today,
Scanning each change in a bouncy display.
A new version leaps into the light,
With selected values shining so bright.
My whiskers twitch with coding cheer,
Celebrating updates—hop on, my dear! 🐇

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.

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

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)

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

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)


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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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.

@jsendo jsendo requested a review from adolfo-pd February 19, 2025 22:59
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: 3

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between d89efa3 and 8940396.

📒 Files selected for processing (5)
  • packages/connect-react/CHANGELOG.md (1 hunks)
  • packages/connect-react/package.json (2 hunks)
  • packages/connect-react/src/components/SelectApp.tsx (2 hunks)
  • packages/connect-react/src/components/SelectComponent.tsx (2 hunks)
  • packages/connect-react/src/hooks/use-apps.tsx (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • packages/connect-react/CHANGELOG.md
🧰 Additional context used
🪛 GitHub Check: Lint Code Base
packages/connect-react/src/components/SelectApp.tsx

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


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


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


[failure] 58-58:
Object properties must go on a new line


[failure] 58-58:
Object properties must go on a new line


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


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


[failure] 61-61:
Object properties must go on a new line


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


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

🪛 GitHub Actions: Pull Request Checks
packages/connect-react/src/components/SelectApp.tsx

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

🔇 Additional comments (7)
packages/connect-react/src/hooks/use-apps.tsx (1)

20-20: LGTM! Good defensive programming practice.

Adding a default empty array ensures that consumers of this hook always receive a consistent return type, preventing potential null/undefined errors.

packages/connect-react/src/components/SelectComponent.tsx (3)

20-23: LGTM! Clean destructuring of hook values.

The simplified destructuring improves code readability.


25-25: LGTM! Good state management practice.

Computing selectedValue from components array ensures synchronization between options and selected value.


33-36: LGTM! Improved Select component configuration.

The changes to option label handling and value prop improve the component's functionality.

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

29-29: LGTM! Good state management practice.

Computing selectedValue from apps array ensures synchronization between options and selected value.

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

3-3: LGTM! Version bump.

Version update to 1.0.0-preview.30 aligns with the changes made to SelectApp and SelectComponent.


22-22: LGTM! Development workflow improvement.

Added watch script enhances the development experience by enabling hot reloading.

Comment on lines 77 to 79
onInputChange={(v) => {
if(v) setQ(v)
}}
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Improve input change handler.

The current implementation might miss important input changes.

Apply this diff to handle empty string inputs:

-      onInputChange={(v) => {
-        if(v) setQ(v)
-      }}
+      onInputChange={(v) => setQ(v || "")}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
onInputChange={(v) => {
if(v) setQ(v)
}}
onInputChange={(v) => setQ(v || "")}

@@ -25,7 +25,8 @@
} = useApps({
q,
});
const { Option } = components;
const { Option, SingleValue } = components;
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Fix formatting according to linting rules.

The component destructuring needs formatting adjustments.

Apply this diff to fix the formatting:

-  const { Option, SingleValue } = components;
+  const {
+    Option,
+    SingleValue,
+  } = components;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const { Option, SingleValue } = components;
const {
Option,
SingleValue,
} = components;
🧰 Tools
🪛 GitHub Check: Lint Code Base

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


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

🪛 GitHub Actions: Pull Request Checks

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

Comment on lines 56 to 69
SingleValue: (singleValueProps) => (
<SingleValue {...singleValueProps}>
<div style={{ display: "flex", gap: 10, alignItems: "center" }}>
<img
src={`https://pipedream.com/s.v0/${singleValueProps.data.id}/logo/48`}
style={{ height: 24, width: 24 }}
alt={singleValueProps.data.name}
/>
<span style={{ whiteSpace: "nowrap" }}>
{singleValueProps.data.name}
</span>
</div>
</SingleValue>
),
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

LGTM! Enhanced visual presentation.

The SingleValue component implementation improves the visual appearance with consistent styling.

However, the formatting needs adjustment:

Apply this diff to fix the formatting:

        SingleValue: (singleValueProps) => (
          <SingleValue {...singleValueProps}>
-            <div style={{ display: "flex", gap: 10, alignItems: "center" }}>
+            <div style={{
+              display: "flex",
+              gap: 10,
+              alignItems: "center",
+            }}>
              <img
-                src={`https://pipedream.com/s.v0/${singleValueProps.data.id}/logo/48`}
-                style={{ height: 24, width: 24 }}
+                src={`https://pipedream.com/s.v0/${singleValueProps.data.id}/logo/48`}
+                style={{
+                  height: 24,
+                  width: 24,
+                }}
                alt={singleValueProps.data.name}
              />
-              <span style={{ whiteSpace: "nowrap" }}>
+              <span style={{
+                whiteSpace: "nowrap",
+              }}>
                {singleValueProps.data.name}
              </span>
            </div>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
SingleValue: (singleValueProps) => (
<SingleValue {...singleValueProps}>
<div style={{ display: "flex", gap: 10, alignItems: "center" }}>
<img
src={`https://pipedream.com/s.v0/${singleValueProps.data.id}/logo/48`}
style={{ height: 24, width: 24 }}
alt={singleValueProps.data.name}
/>
<span style={{ whiteSpace: "nowrap" }}>
{singleValueProps.data.name}
</span>
</div>
</SingleValue>
),
SingleValue: (singleValueProps) => (
<SingleValue {...singleValueProps}>
<div style={{
display: "flex",
gap: 10,
alignItems: "center",
}}>
<img
src={`https://pipedream.com/s.v0/${singleValueProps.data.id}/logo/48`}
style={{
height: 24,
width: 24,
}}
alt={singleValueProps.data.name}
/>
<span style={{
whiteSpace: "nowrap",
}}>
{singleValueProps.data.name}
</span>
</div>
</SingleValue>
),
🧰 Tools
🪛 GitHub Check: Lint Code Base

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


[failure] 58-58:
Object properties must go on a new line


[failure] 58-58:
Object properties must go on a new line


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


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


[failure] 61-61:
Object properties must go on a new line


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


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

adolfo-pd
adolfo-pd previously approved these changes Feb 19, 2025
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

♻️ Duplicate comments (1)
packages/connect-react/src/components/SelectApp.tsx (1)

89-91: 🛠️ Refactor suggestion

Improve input change handler.

The current implementation might miss important input changes.

Apply this diff to handle empty string inputs:

-      onInputChange={(v) => {
-        if(v) setQ(v)
-      }}
+      onInputChange={(v) => setQ(v || "")}
🧹 Nitpick comments (1)
packages/connect-react/src/components/SelectApp.tsx (1)

32-32: Consider a more defensive implementation.

While the current implementation works, it could be more robust by handling potential undefined values.

Apply this diff for a more defensive implementation:

-  const selectedValue = apps?.find((o) => o.name_slug === value?.name_slug) || null;
+  const selectedValue = apps?.find((o) => o?.name_slug === value?.name_slug) ?? null;
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 8940396 and 6f7b748.

📒 Files selected for processing (2)
  • packages/connect-react/src/components/SelectApp.tsx (2 hunks)
  • packages/connect-react/src/components/SelectComponent.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/connect-react/src/components/SelectComponent.tsx
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: pnpm publish
  • GitHub Check: Lint Code Base
🔇 Additional comments (3)
packages/connect-react/src/components/SelectApp.tsx (3)

28-31: LGTM! Well-formatted component destructuring.

The destructuring follows proper formatting with line breaks.


59-81: LGTM! Enhanced visual presentation.

The SingleValue component implementation improves the visual appearance with consistent styling.


87-87: LGTM! Consistent value handling.

Using selectedValue ensures proper synchronization between the selected option and the apps array.

@jsendo jsendo merged commit 438d8cd into master Feb 19, 2025
8 checks passed
@jsendo jsendo deleted the je/reset-component-key-on-app-change branch February 19, 2025 23:59
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.

2 participants