ngrx/entity pagination selector: configuring page‑size validation
0 reputation · 11 Nov 2025, 09:18 UTC
Goal: ensure that the pagination selector created with createPaginationSelector validates that the supplied page size is a positive integer before slicing the entity map.
Currently the selector accepts any number; zero or negative produce an empty slice, and excessively large page sizes cause unnecessary work. This silent behavior can hide bugs in UI components that miscalculate pagination parameters, especially when combined with rapid scrolling effects.
Uncertainty: should the selector throw an error, automatically clamp to a minimum of 1, or leave validation to consumer code? Need to decide on a configuration option or default behavior that balances safety and flexibility.
Should the selector throw a TypeError when pageSize ≤ 0? Should it automatically reset pageSize to 1 in such cases? Should the library expose a validator function that callers can invoke before selecting?