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

AutoCrud: add support for limiting the pageSize without deriving/overriding the Hilla services #3203

Open
taefi opened this issue Feb 4, 2025 · 3 comments
Labels
enhancement New feature or request hilla Issues related to Hilla

Comments

@taefi
Copy link
Contributor

taefi commented Feb 4, 2025

Describe your motivation

The idea comes from a forum question, asking for the possibility of setting maxPageSize limit for handling cases such as forged requests for either no page size or a very big one.

Describe the solution you'd like

Support for this could be added by giving control to the users for setting maxPageSize either through already existing properties (being compatible with spring-data-jpa standards makes it easier to integrate Hilla in already existing projects):

spring:
  data:
    web:
      pageable:
        max-page-size: 10
    rest:
      max-page-size: 10

or by enabling the users to define a default page bean which can be taken into account by the framework, if present.

It would be desirable to support the already existing / standard ways to support this in Vaadin, unless some specific need prevents us from using them.

Describe alternatives you've considered

Creating a couple of CRUD super classes in the user workspace that set the limits by overriding the defaults in CrudRepositoryService and etc. when defining a BrowserCallable service.

Additional context

No response

@taefi taefi added enhancement New feature or request hilla Issues related to Hilla labels Feb 4, 2025
@taefi
Copy link
Contributor Author

taefi commented Feb 4, 2025

Some of the CRUD related classes are moved to flow/vaadin-spring repo, so there might be some extra efforts needed when adding the support for this enhancement.

@platosha
Copy link
Contributor

platosha commented Feb 4, 2025

Testing that the properties are applied with a @SpringBootTest should be enough.

@taefi
Copy link
Contributor Author

taefi commented Feb 5, 2025

Another consideration is the current implementation of CrudRepositoryService in Flow is slightly different from what we have in Hilla, where it doesn't provide a default constructor, and that means the user code should always define their CRUD services by implementing the constructor that accepts the repository, while in Hilla, you don't need any constructors. That's a breaking change for Hilla users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request hilla Issues related to Hilla
Projects
None yet
Development

No branches or pull requests

2 participants