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: Ensure Select Column Displays Data When Options Are Not Set #35817

Merged
merged 4 commits into from
Aug 23, 2024

Conversation

jacquesikot
Copy link
Contributor

@jacquesikot jacquesikot commented Aug 21, 2024

Description

Problem
When using a table widget, changing a column to the "Select" type causes the data in that column to disappear unless the options property is explicitly set. This creates a poor user experience, as it appears that the data has been lost or the widget is malfunctioning.

Solution
We have implemented a fallback mechanism to ensure a smoother user experience. If no options are set in the property pane, the label inside the select cell will now default to displaying the existing value. This ensures that the data remains visible, even in the absence of predefined options.

Fixes #35807

Automation

/ok-to-test tags="@tag.Widget, @tag.Select, @tag.Binding, @tag.Table, @tag.Sanity"

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/10513374411
Commit: 1e89468
Cypress dashboard.
Tags: @tag.Widget, @tag.Select, @tag.Binding, @tag.Table, @tag.Sanity
Spec:


Thu, 22 Aug 2024 19:43:53 UTC

Communication

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

  • Yes
  • No

Summary by CodeRabbit

  • New Features

    • Enhanced the select column in the table widget to return a default value when no options are available.
  • Bug Fixes

    • Improved robustness of the select cell component to prevent errors when the options array is empty.
  • Tests

    • Updated and reorganized test cases for the select column to improve clarity and specificity.
    • Introduced a new test case to validate default value behavior when no options are provided.

@jacquesikot jacquesikot added Table Widget V2 Issues related to Table Widget V2 ok-to-test Required label for CI Widgets & Accelerators Pod Issues related to widgets & Accelerators labels Aug 21, 2024
@jacquesikot jacquesikot self-assigned this Aug 21, 2024
Copy link
Contributor

coderabbitai bot commented Aug 21, 2024

Walkthrough

The recent changes enhance the functionality and reliability of the select column within the table widget. The modifications improve the clarity and organization of the test cases, ensuring comprehensive coverage of various scenarios, including default value handling when no options are available. Additionally, the SelectCell component has been fortified with a guard clause, which stabilizes its output when the options array is empty, ultimately improving user experience.

Changes

Files Change Summary
app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/Select1_spec.ts
app/client/src/widgets/TableWidgetV2/component/cellComponents/SelectCell.tsx
Updated test cases to enhance clarity and organization for select column handling. Introduced a guard clause in SelectCell to ensure stability when options are empty.

Assessment against linked issues

Objective Addressed Explanation
Ensure data displays correctly in table columns (bug #35807)
Fix flakiness in tests related to table widget functionality (issue #35563)

Possibly related issues

  • Fix flakiness of app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/Select1_spec.ts: The changes may indirectly enhance the stability of the test suite, addressing existing flakiness concerns.

Poem

In the realm of tables, where options align,
Clarity blooms, and tests intertwine.
No more empty echoes, as values now sing,
Robustness restored, let the praises ring!
A dance of selection, in harmony's grace,
In code's gentle hands, we find our place. ✨


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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.

@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 Regressed Scenarios that were working before but have now regressed Table Widget Widgets Product This label groups issues related to widgets labels Aug 21, 2024
@jacquesikot jacquesikot changed the title fix: table select without options fix: Ensure Select Column Displays Data When Options Are Not Set Aug 21, 2024
@jacquesikot
Copy link
Contributor Author

/build-deploy-preview skip-tests=true

Copy link

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/10489253939.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 35817.
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: 1

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 5dcdeaf and 73acbdc.

Files selected for processing (2)
  • app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/Select1_spec.ts (9 hunks)
  • app/client/src/widgets/TableWidgetV2/component/cellComponents/SelectCell.tsx (1 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.
Biome
app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/Select1_spec.ts

[error] 19-19: Don't focus the test.

The 'only' method is often used for debugging or during implementation. It should be removed before deploying to production.
Consider removing 'only' to ensure all tests are executed.
Unsafe fix: Remove focus from test.

(lint/suspicious/noFocusedTests)


[error] 34-34: Don't focus the test.

The 'only' method is often used for debugging or during implementation. It should be removed before deploying to production.
Consider removing 'only' to ensure all tests are executed.
Unsafe fix: Remove focus from test.

(lint/suspicious/noFocusedTests)

Additional comments not posted (2)
app/client/src/widgets/TableWidgetV2/component/cellComponents/SelectCell.tsx (1)

203-203: Great job on enhancing robustness!

The added condition to return the value when options is empty ensures that the component behaves correctly even without predefined options. This aligns well with the PR objectives to improve user experience.

app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/Select1_spec.ts (1)

Line range hint 19-363: Well done on improving test clarity and coverage!

The updated test descriptions and the addition of new validation scenarios significantly enhance the readability and maintainability of the test suite. This ensures that the select column functionality is thoroughly validated.

Tools
Biome

[error] 34-34: Don't focus the test.

The 'only' method is often used for debugging or during implementation. It should be removed before deploying to production.
Consider removing 'only' to ensure all tests are executed.
Unsafe fix: Remove focus from test.

(lint/suspicious/noFocusedTests)

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

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 73acbdc and 12ee086.

Files selected for processing (1)
  • app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/Select1_spec.ts (8 hunks)
Files skipped from review as they are similar to previous changes (1)
  • app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/Select1_spec.ts

Copy link

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

rahulbarwal
rahulbarwal previously approved these changes Aug 21, 2024
@btsgh
Copy link
Collaborator

btsgh commented Aug 21, 2024

  1. Imported the Regression application and checked for the Tagging calendar issue mentioned in the original bug. Works fine for column type set as Select.
  2. Changed the column types from Select to Plain Text and viceversa and saw that data is retained
  3. Created a new application, added a crud page, and changed the column type from Plain Text to Select for a particular column. Works fine.
  4. Moved it back to Plain Text, works fine.
  5. Deployed the apps and checked data in deploy mode. Works fine.
  6. Forked Regression app to another workspace and tested that the column data shows up fine for column type set as Select

sagar-qa007
sagar-qa007 previously approved these changes Aug 21, 2024
@sagar-qa007
Copy link
Contributor

@jacquesikot Please check test case failure.

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

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 12ee086 and 1e89468.

Files selected for processing (1)
  • app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/Select1_spec.ts (8 hunks)
Files skipped from review as they are similar to previous changes (1)
  • app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/Select1_spec.ts

@jacquesikot jacquesikot added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Aug 22, 2024
@jacquesikot jacquesikot merged commit 28ac53b into release Aug 23, 2024
182 of 188 checks passed
@jacquesikot jacquesikot deleted the fix/table-select-without-options branch August 23, 2024 09:10
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 ok-to-test Required label for CI Production Regressed Scenarios that were working before but have now regressed Table Widget V2 Issues related to Table Widget V2 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
4 participants