Story: As a user I want that Cat-a-lot remembers its state over page loads when moving through pagination or when i am doing repetitive tasks.
| **Done** | **Feature** | **Current version ** | **Wanted **
|X| Search key | remembers last search key after page load using cookie | same
| | Category list state | resets on page load | remembers state during "same" session
| |.UI open / minimized state | remembers if new page is in same namespace than last | support multiple namespaces
| | Cat-a-lot window size and position | resets on page load | remembers during "same" session
**Category list state**
Both search field and category list clicks call `updateCats(newcat) ` for generating the list. Code could store the last newcat to `mw.cookie.set( 'catAlot_lastcat', newcat )` and when Cat-a-lot is enabled on page load it could restore it by calling `updateCats(mw.cookie.get( 'catAlot_lastcat'))` . When user manually closes the Cat-a-lot ui then cookie could be cleared.
https://commons.wikimedia.org/wiki/User:Zache/Gadget-Cat-a-lot-20250602.js#L-1792
https://commons.wikimedia.org/wiki/User:Zache/Gadget-Cat-a-lot-20250602.js#L-2014
Tricky part is to know when UI should not remember last state
**UI open / minimized state**
Based on the code, cat-a-lot will only remember if it is open if the new page is in the same namespace. For example, if one moves from category to search or from search to category, then it will minimize cat-a-lot.
* https://commons.wikimedia.org/wiki/User:Zache/Gadget-Cat-a-lot-20250602.js#L-382
Tricky part is to know when UI should not remember last state. For this we could try to have separate states for all namespaces so that it would remember remember the state even if user moves between `Search` and `Category` namespace.
**Remember Cat-a-lot window size and position**
Needs investigation
**Notes**
Currently Cat-a-lot uses cookies, but better place is browsers localstorage.