Skip to content

Biz/dj 2837 show label and keep selected remote option dropdown enabled #15438

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Conversation

bzwrk
Copy link
Contributor

@bzwrk bzwrk commented Jan 28, 2025

WHY

Summary by CodeRabbit

Release Notes for @pipedream/connect-react v1.0.0-preview.25

  • New Features

    • Now displays prop labels instead of values after selecting dynamic props
  • Bug Fixes

    • Resolved issue with remote options not reloading correctly when form component is re-rendered
    • Improved handling of input options in select controls
  • Performance

    • Streamlined option processing logic in select components
    • Enhanced state management for configured properties on component load
    • Added flexible handling for input values with specific properties

Copy link

linear bot commented Jan 28, 2025

Copy link

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

Copy link
Contributor

coderabbitai bot commented Jan 28, 2025

Walkthrough

This pull request introduces version 1.0.0-preview.25 of the @pipedream/connect-react package. The changes focus on improving the handling of dynamic props and resolving issues with remote option reloading. Key modifications include enhancing the display of prop labels instead of values, simplifying option processing in the ControlSelect component, and adding a new effect to manage configured props more effectively. The changes aim to provide a more consistent and user-friendly interface for form interactions.

Changes

File Change Summary
packages/connect-react/CHANGELOG.md Added version 1.0.0-preview.25 with improvements in prop label display and remote option reloading
packages/connect-react/package.json Updated package version from 1.0.0-preview.24 to 1.0.0-preview.25
packages/connect-react/src/components/ControlSelect.tsx Simplified handleChange function logic for processing input options
packages/connect-react/src/hooks/form-context.tsx Added useEffect to update queryDisabledIdx based on _configuredProps
packages/connect-react/src/utils/component.ts Added conditional check in valuesFromOptions to handle objects with __lv array property

Possibly related PRs

Suggested labels

bug, javascript, tracked internally, prioritized

Suggested reviewers

  • jverce

Poem

🐰 A rabbit's tale of code so bright,
Props and labels now in clear light,
Reloading smooth, no more a fight,
With connect-react, our dev delight!
Version twenty-five takes flight! 🚀


📜 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 8aed3a6 and c8d82bc.

📒 Files selected for processing (1)
  • packages/connect-react/src/utils/component.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/connect-react/src/utils/component.ts
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: pnpm publish

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.

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 (1)
packages/connect-react/src/hooks/form-context.tsx (1)

257-261: Consider memoizing _configuredProps to prevent unnecessary updates.

While the new effect correctly fixes the remote option reloading issue, frequent updates to _configuredProps could trigger unnecessary recalculations of queryDisabledIdx.

Consider using useMemo to optimize the dependency:

+ const memoizedConfiguredProps = useMemo(() => _configuredProps, [JSON.stringify(_configuredProps)]);
  useEffect(() => {
-   updateConfiguredPropsQueryDisabledIdx(_configuredProps)
+   updateConfiguredPropsQueryDisabledIdx(memoizedConfiguredProps)
  }, [
-   _configuredProps,
+   memoizedConfiguredProps,
  ]);
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 7f3c8a5 and 8835a04.

📒 Files selected for processing (5)
  • packages/connect-react/CHANGELOG.md (1 hunks)
  • packages/connect-react/package.json (1 hunks)
  • packages/connect-react/src/components/ControlSelect.tsx (1 hunks)
  • packages/connect-react/src/hooks/form-context.tsx (1 hunks)
  • packages/connect-react/src/utils/component.ts (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • packages/connect-react/package.json
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Lint Code Base
  • GitHub Check: pnpm publish
🔇 Additional comments (3)
packages/connect-react/src/components/ControlSelect.tsx (1)

178-183: LGTM! The changes improve the handling of selected options.

The simplified logic correctly preserves label information for both single and multi-select cases, which aligns with the changelog entry about showing prop labels instead of values.

packages/connect-react/src/utils/component.ts (1)

43-45: LGTM! The new condition handles labeled values correctly.

The added check properly extracts values from objects with the __lv property, complementing the changes in ControlSelect.tsx for consistent handling of labeled values.

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

4-8: LGTM! Changelog entries accurately reflect the code changes.

The entries clearly document both the UI improvement (showing prop labels) and the bug fix (remote option reloading), which align with the code changes in ControlSelect.tsx and form-context.tsx.

Comment on lines -174 to -187
const vs = [];
for (const _o of o) {
if (prop.withLabel) {
vs.push(_o);
} else {
vs.push(_o.value);
}
}
onChange(vs);
} else {
onChange(o);
}
} else if (typeof o === "object" && "value" in o) {
if (prop.withLabel) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We should not be handling withLabel here. It's handled here All configured props should have { __lv: { label: "", value: "" } } shape.

@bzwrk bzwrk merged commit 614a7ec into master Jan 29, 2025
8 checks passed
@bzwrk bzwrk deleted the biz/dj-2837-show-label-and-keep-selected-remote-option-dropdown-enabled branch January 29, 2025 00:13
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants