Skip to content

Conversation

@brunoagretti
Copy link
Member

@brunoagretti brunoagretti commented Jul 25, 2025

Ensure that when a custom value provider is defined for a column, its result is used exclusively. If the provider returns null, the nullValueSupplier is applied (if available). Other extraction strategies are skipped in this case.

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of custom value providers in grid columns to ensure that null values are correctly substituted when a null value supplier is defined. This prevents unintended value extraction when custom providers return null.

@coderabbitai
Copy link

coderabbitai bot commented Jul 25, 2025

Walkthrough

The extractValueFromColumn method in the GridExporter class was updated to improve its logic when handling custom value providers. The method now returns immediately after processing a custom value provider and a possible null value supplier, ensuring no further extraction logic is applied in these cases.

Changes

File(s) Change Summary
src/main/java/com/flowingcode/.../GridExporter.java Refined extractValueFromColumn to return early after handling custom value providers and null value suppliers, preventing further processing.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 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 9076728 and f463873.

📒 Files selected for processing (1)
  • src/main/java/com/flowingcode/vaadin/addons/gridexporter/GridExporter.java (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: javier-godoy
PR: FlowingCode/GridExporterAddon#119
File: src/main/java/com/flowingcode/vaadin/addons/gridexporter/CsvStreamResourceWriter.java:77-93
Timestamp: 2024-10-08T21:28:24.972Z
Learning: User javier-godoy requested to open a follow-up GitHub issue to discuss resource management in the refactored code of CsvStreamResourceWriter, highlighting the absence of try-with-resources in the previous implementation.
Learnt from: javier-godoy
PR: FlowingCode/GridExporterAddon#119
File: src/main/java/com/flowingcode/vaadin/addons/gridexporter/CsvStreamResourceWriter.java:77-93
Timestamp: 2024-07-27T22:14:37.039Z
Learning: User javier-godoy requested to open a follow-up GitHub issue to discuss resource management in the refactored code of CsvStreamResourceWriter, highlighting the absence of try-with-resources in the previous implementation.
Learnt from: javier-godoy
PR: FlowingCode/GridExporterAddon#143
File: src/main/java/com/flowingcode/vaadin/addons/gridexporter/GridExporter.java:315-315
Timestamp: 2024-10-08T21:28:24.972Z
Learning: In the `GridExporter` class, CSV exports are not subject to concurrent controls, so `getCsvStreamResource` returns a `StreamResource` instead of a `GridExporterStreamResource`.
Learnt from: javier-godoy
PR: FlowingCode/GridExporterAddon#143
File: src/main/java/com/flowingcode/vaadin/addons/gridexporter/GridExporter.java:315-315
Timestamp: 2024-09-26T18:26:03.345Z
Learning: In the `GridExporter` class, CSV exports are not subject to concurrent controls, so `getCsvStreamResource` returns a `StreamResource` instead of a `GridExporterStreamResource`.
src/main/java/com/flowingcode/vaadin/addons/gridexporter/GridExporter.java (2)

Learnt from: javier-godoy
PR: #143
File: src/main/java/com/flowingcode/vaadin/addons/gridexporter/GridExporter.java:315-315
Timestamp: 2024-10-08T21:28:24.972Z
Learning: In the GridExporter class, CSV exports are not subject to concurrent controls, so getCsvStreamResource returns a StreamResource instead of a GridExporterStreamResource.

Learnt from: javier-godoy
PR: #143
File: src/main/java/com/flowingcode/vaadin/addons/gridexporter/GridExporter.java:315-315
Timestamp: 2024-09-26T18:26:03.345Z
Learning: In the GridExporter class, CSV exports are not subject to concurrent controls, so getCsvStreamResource returns a StreamResource instead of a GridExporterStreamResource.

🔇 Additional comments (1)
src/main/java/com/flowingcode/vaadin/addons/gridexporter/GridExporter.java (1)

224-230: LGTM! Custom value provider prioritization implemented correctly.

The implementation correctly prioritizes custom value providers as intended. When a custom provider exists, the method now:

  1. Applies the custom value provider
  2. Handles null results by applying the nullValueSupplier if available
  3. Returns immediately, bypassing all fallback extraction logic

This ensures custom providers take precedence over other extraction methods, which aligns perfectly with the PR objectives.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 1.x-fix-customvp-priority

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 generate unit tests to generate unit tests for 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.

@brunoagretti brunoagretti requested review from Copilot and mlopezFC July 25, 2025 19:12
@sonarqubecloud
Copy link

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes the value extraction logic for grid columns to properly prioritize custom value providers. When a custom value provider is defined, it now takes precedence over all other extraction methods, with null values being handled by the nullValueSupplier if available.

Comment on lines +229 to 231
return value;
}

Copy link

Copilot AI Jul 25, 2025

Choose a reason for hiding this comment

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

The early return should be moved outside the if block to ensure it's always executed when a custom value provider exists, regardless of whether the value is null or not.

Suggested change
return value;
}
}
if (value != null) {
return value;
}

Copilot uses AI. Check for mistakes.
Copy link
Member Author

Choose a reason for hiding this comment

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

The early return must stay inside the if (customVP != null) block to ensure no fallback logic is applied when a custom provider is present, even if its value is null.

@javier-godoy javier-godoy moved this from To Do to Inbox (needs triage) in Flowing Code Addons Jul 25, 2025
@javier-godoy
Copy link
Member

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Jul 25, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@brunoagretti brunoagretti deleted the 1.x-fix-customvp-priority branch July 28, 2025 20:47
@github-project-automation github-project-automation bot moved this from Inbox (needs triage) to Done in Flowing Code Addons Jul 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

3 participants