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

fix: select column to display cell value when options are mismatched #38387

Open
wants to merge 2 commits into
base: release
Choose a base branch
from

Conversation

jacquesikot
Copy link
Contributor

@jacquesikot jacquesikot commented Dec 27, 2024

Description

Problem
When a table cell is configured with the Select column type, the cell value is not displayed if it does not match any of the label-value pairs in the select options. This results in a broken user experience where it appears as if the cell has no value.

Expected Behaviour
The table cell should always display its value if it exists, regardless of whether it matches the provided select options.

Solution
To address this issue, the default behaviour for the select options has been updated to prioritise the cell's value instead of falling back to an empty string. This ensures that cell values are always visible to the user, even if they are not part of the predefined select options.

Fixes #35807

Automation

/ok-to-test tags=""

🔍 Cypress test results

Warning

Tests have not run on the HEAD d39d7f3 yet


Fri, 27 Dec 2024 07:22:19 UTC

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

Summary by CodeRabbit

  • Bug Fixes
    • Improved display logic in the SelectCell component to show the value when no matching option is found.
    • Updated test cases for the Select column type functionality to ensure accurate verification of select options and display behavior when options are not provided.

@jacquesikot jacquesikot added the Widgets & Accelerators Pod Issues related to widgets & Accelerators label Dec 27, 2024
@jacquesikot jacquesikot self-assigned this Dec 27, 2024
Copy link
Contributor

coderabbitai bot commented Dec 27, 2024

Walkthrough

The pull request modifies the SelectCell component in the TableWidgetV2 to change the logic for computing the cellLabelValue. When no matching option is found, instead of returning an empty string, it now returns the original value. This adjustment ensures that the displayed value is retained even when the selected option does not exist in the provided options array. Additionally, the test cases for the select column type have been updated for clarity and accuracy.

Changes

File Change Summary
app/client/src/widgets/TableWidgetV2/component/cellComponents/SelectCell.tsx Modified cellLabelValue logic to return the original value when no matching option is found.
app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/Select1_spec.ts Renamed and renumbered test cases for clarity, ensuring accurate verification of select options behavior.

Assessment against linked issues

Objective Addressed Explanation
Fix empty column data issue [#35807]
Ensure data visibility in table columns

Possibly related issues

Possibly related PRs

Suggested labels

Enhancement, ok-to-test, Select Widget

Suggested reviewers

  • ApekshaBhosale
  • rahulbarwal
  • sagar-qa007

Poem

In tables where data once did hide,
A select cell's label now takes pride.
No more empty spaces, blank and cold,
The value speaks, its story told! 🔍📊
Code's magic brings the truth to light,
Ensuring every cell shines bright!

Tip

CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command @coderabbitai generate docstrings to have CodeRabbit automatically generate docstrings for your pull request. We would love to hear your feedback on Discord.


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.

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.

@github-actions github-actions bot added Bug Something isn't working Critical This issue needs immediate attention. Drop everything else High This issue blocks a user from building or impacts a lot of users Needs Triaging Needs attention from maintainers to triage Production QA Needs QA attention QA Pod Issues under the QA Pod Regressed Scenarios that were working before but have now regressed Table Widget Widgets Product This label groups issues related to widgets labels Dec 27, 2024
@jacquesikot
Copy link
Contributor Author

/build-deploy-preview skip-tests=true

Copy link

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/12512977970.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 38387.
recreate: .

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)
app/client/src/widgets/TableWidgetV2/component/cellComponents/SelectCell.tsx (1)

207-207: Consider null/undefined values when no matching option is found.

Returning value ensures that valid but unlisted entries are displayed. However, ensure that value can never be null or undefined; otherwise, it might render incorrectly. A quick null/undefined check or fallback for such cases could improve robustness.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 092445e and 2da7c04.

📒 Files selected for processing (1)
  • app/client/src/widgets/TableWidgetV2/component/cellComponents/SelectCell.tsx (1 hunks)

Copy link

Deploy-Preview-URL: https://ce-38387.dp.appsmith.com

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)
app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/Select1_spec.ts (1)

410-410: Correct the typographical error
“filering” should be spelled “filtering.”

-it("12. should check that server side filering is working", () => {
+it("12. should check that server side filtering is working", () => {
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2da7c04 and d39d7f3.

📒 Files selected for processing (1)
  • app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/Select1_spec.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/Select1_spec.ts (1)

Pattern app/client/cypress/**/**.*: Review the following e2e test code written using the Cypress test library. Ensure that:

  • Follow best practices for Cypress code and e2e automation.
  • Avoid using cy.wait in code.
  • Avoid using cy.pause in code.
  • Avoid using agHelper.sleep().
  • Use locator variables for locators and do not use plain strings.
  • Use data-* attributes for selectors.
  • Avoid Xpaths, Attributes and CSS path.
  • Avoid selectors like .btn.submit or button[type=submit].
  • Perform logins via API with LoginFromAPI.
  • Perform logout via API with LogOutviaAPI.
  • Perform signup via API with SignupFromAPI.
  • Avoid using it.only.
  • Avoid using after and aftereach in test cases.
  • Use multiple assertions for expect statements.
  • Avoid using strings for assertions.
  • Do not use duplicate filenames even with different paths.
  • Avoid using agHelper.Sleep, this.Sleep in any file in code.
🔇 Additional comments (2)
app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/Select1_spec.ts (2)

339-343: All good for mismatch scenario
This test correctly verifies that the table cell displays its existing value even if it doesn't match any of the provided options, which aligns perfectly with the PR's objective.


345-345: Comprehensive testing of new row select options
Good job handling multiple sub-scenarios to ensure proper behavior of new row select options.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Critical This issue needs immediate attention. Drop everything else High This issue blocks a user from building or impacts a lot of users Needs Triaging Needs attention from maintainers to triage Production QA Pod Issues under the QA Pod QA Needs QA attention Regressed Scenarios that were working before but have now regressed Table Widget Widgets & Accelerators Pod Issues related to widgets & Accelerators Widgets Product This label groups issues related to widgets
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Data in a column of a table is coming up as empty, though data exists in the column
1 participant