primefaces / primeng

The Most Complete Angular UI Component Library
https://primeng.org
Other
10.61k stars 4.62k forks source link

Component: P-Table's state pagination does not restore if signal's initial value is '[]' #16513

Open ross1296 opened 1 month ago

ross1296 commented 1 month ago

Describe the bug

I am using PrimeNG for tables (p-table) with the built in session state, and NgRx SignalStore's withEntities(). I perform a HTTP request and then patch the entity state with the result.

I then use the signal to populate the table, like so: [value]="store.entities()"

The issue is that the default/initial value of withEntities()'s entities() signal is []

When PrimeNG goes to restore the state, the pagination is not restored because of this. So if I was on page 3, navigate away and come back to the table, it goes back to page 1. Column sorts and filters are maintained.

This issue does not happen if the initital value is undefined, but the default value of withEntities()'s entities() signal cannot be changed and is, by design, suppose to be [].

Environment

Reproducer

No response

Angular version

18.2.2

PrimeNG version

17.18.9

Build / Runtime

TypeScript

Language

TypeScript

Node version (for AoT issues node --version)

20.16.0

Browser(s)

No response

Steps to reproduce the behavior

No response

Expected behavior

No response

github-actions[bot] commented 1 week ago

Due to PrimeNG team's busy roadmap, this issue is available for anyone to work on. Make sure to reference this issue in your pull request. :sparkles: Thank you for your contribution! :sparkles: