Skip to content

Conversation

ugur-vaadin
Copy link
Contributor

Description

A recent change in Flow has limited the number of pages in the response to 10. Also, there is an issue to add another constraint to the responses to have a maximum item count of 500. This PR ensures that these constraints are respected in the Grid. If more pages or items are requested from the, an exception will be thrown.

Should be merged after the Flow issue is merged.

Fixes #3708

Type of change

  • Bugfix
  • Feature

Checklist

  • I have read the contribution guide: https://vaadin.com/docs/latest/contributing/overview
  • I have added a description following the guideline.
  • The issue is created in the corresponding repository and I have referenced it.
  • I have added tests to ensure my change is effective and works as intended.
  • New and existing tests are passing locally with my change.
  • I have performed self-review and corrected misspellings.

@ugur-vaadin ugur-vaadin linked an issue Sep 29, 2022 that may be closed by this pull request
… the connector

Correct length check, add isAllRowsVisible check, carry the code to the server side.
@sonarqubecloud
Copy link

sonarqubecloud bot commented Oct 4, 2022

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell E 41 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Copy link
Member

@tomivirkki tomivirkki left a comment

Choose a reason for hiding this comment

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

LGTM

Should be merged after the Flow vaadin/flow#14630 is merged.

I think this change would already provide value for users, even before the DataProvider issue in Flow is fixed.

| IllegalAccessException | IllegalArgumentException
| InvocationTargetException e) {
if (e.getCause() instanceof IllegalArgumentException) {
throw (IllegalArgumentException) e.getCause();
Copy link
Contributor

Choose a reason for hiding this comment

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

Did I read it correctly that this just re-throws IllegalArgumentException? Could it be then excluded from the union of exceptions above?

if (e.getCause() instanceof IllegalArgumentException) {
throw (IllegalArgumentException) e.getCause();
}
Assert.fail("Could not call Grid.setRequestedRange");
Copy link
Contributor

@vursen vursen Oct 5, 2022

Choose a reason for hiding this comment

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

I guess it would be helpful to know the cause of the failure here. Could we simply not handle these exceptions like here? Does that approach have any negative consequences?

@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell E 45 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@ugur-vaadin ugur-vaadin merged commit e54b056 into master Nov 22, 2022
@ugur-vaadin ugur-vaadin deleted the 3708-grid-and-treegrid-empty-item-lines-after-10-x-pagesize-items branch November 22, 2022 13:44
ZheSun88 pushed a commit that referenced this pull request Nov 22, 2022
…it (#3798)

* fix: throw error if requested page or item count exceeds the Flow limit

* fix: correct the if clause and check it in the server side instead of the connector

Correct length check, add isAllRowsVisible check, carry the code to the server side.

* fix: change the exception message

* test: add tests for request variations
ZheSun88 pushed a commit that referenced this pull request Nov 22, 2022
…it (#3798)

* fix: throw error if requested page or item count exceeds the Flow limit

* fix: correct the if clause and check it in the server side instead of the connector

Correct length check, add isAllRowsVisible check, carry the code to the server side.

* fix: change the exception message

* test: add tests for request variations
ZheSun88 pushed a commit that referenced this pull request Nov 22, 2022
…it (#3798)

* fix: throw error if requested page or item count exceeds the Flow limit

* fix: correct the if clause and check it in the server side instead of the connector

Correct length check, add isAllRowsVisible check, carry the code to the server side.

* fix: change the exception message

* test: add tests for request variations
ZheSun88 pushed a commit that referenced this pull request Nov 22, 2022
…it (#3798)

* fix: throw error if requested page or item count exceeds the Flow limit

* fix: correct the if clause and check it in the server side instead of the connector

Correct length check, add isAllRowsVisible check, carry the code to the server side.

* fix: change the exception message

* test: add tests for request variations
ZheSun88 pushed a commit that referenced this pull request Nov 22, 2022
…it (#3798) (#4171)

* fix: throw error if requested page or item count exceeds the Flow limit

* fix: correct the if clause and check it in the server side instead of the connector

Correct length check, add isAllRowsVisible check, carry the code to the server side.

* fix: change the exception message

* test: add tests for request variations

Co-authored-by: Ugur Saglam <106508695+ugur-vaadin@users.noreply.github.com>
ZheSun88 pushed a commit that referenced this pull request Nov 22, 2022
…it (#3798) (#4172)

* fix: throw error if requested page or item count exceeds the Flow limit

* fix: correct the if clause and check it in the server side instead of the connector

Correct length check, add isAllRowsVisible check, carry the code to the server side.

* fix: change the exception message

* test: add tests for request variations

Co-authored-by: Ugur Saglam <106508695+ugur-vaadin@users.noreply.github.com>
ZheSun88 pushed a commit that referenced this pull request Nov 22, 2022
…it (#3798) (#4173)

* fix: throw error if requested page or item count exceeds the Flow limit

* fix: correct the if clause and check it in the server side instead of the connector

Correct length check, add isAllRowsVisible check, carry the code to the server side.

* fix: change the exception message

* test: add tests for request variations

Co-authored-by: Ugur Saglam <106508695+ugur-vaadin@users.noreply.github.com>
ZheSun88 pushed a commit that referenced this pull request Nov 22, 2022
…it (#3798) (#4174)

* fix: throw error if requested page or item count exceeds the Flow limit

* fix: correct the if clause and check it in the server side instead of the connector

Correct length check, add isAllRowsVisible check, carry the code to the server side.

* fix: change the exception message

* test: add tests for request variations

Co-authored-by: Ugur Saglam <106508695+ugur-vaadin@users.noreply.github.com>
@vaadin-bot
Copy link
Collaborator

vaadin-bot commented Nov 25, 2022

This ticket/PR has been released with Vaadin 24.0.0.alpha5 and is also targeting the upcoming stable 24.0.0 version.
This ticket/PR has been released with Vaadin 23.2.9
This ticket/PR has been released with Vaadin 23.1.16

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Grid and TreeGrid: Empty item lines after 10 x pageSize items.
5 participants