nowcommunity / nowdatabase

Rebuild of the nowdatabase application for luomus
MIT License
3 stars 1 forks source link

Table state persisting in url #18

Closed ShootingStar91 closed 4 months ago

ShootingStar91 commented 4 months ago

See if it is possible to save table state in url and load it when user comes back via previous-button or link. It's not necessary to yet implement all of these in a functional way, but to be sure that they can be implemented with the current table choice.

ShootingStar91 commented 4 months ago

Seems to work and is not too complicated.

However, since the table (at least by default) works by instantly updating the table after changes like one character is made to filter, it may not be sensible to save all the url changes to history. Also, because the history is the browsers history this might make the history a mess to navigate. Ask customers later when the feature is more fleshed out, if its ok not to persist the tables internal changes in history every time, but only the last state before going to another view or the individual item page.

ShootingStar91 commented 4 months ago

The setting "autoResetPageIndex" had to be turned false. Otherwise it would always reset pageIndex to 0 on first render, after reloading state from url. It works now, but it's not known if this will end up having adverse effects: documentation said that this setting prevents user being shown empty pages on certain changes, I did not get this by testing but it could happen.