Limit $recentSearches
State to Hold a Maximum of 5 Entries
#70
Labels
↗️ medium priority
This issue is crucial
🤲 help wanted
Extra attention is needed
✨ enhancement
New feature or request
Currently, the
$recentSearches
state holds all the recent searches without any limit. To improve user experience and ensure that the list of recent searches remains manageable, we need to limit the$recentSearches
state to hold a maximum of 5 entries. When a new word is added and the limit is reached, the oldest entry should be removed to make space for the new one.Current Implementation
The current implementation does not limit the number of recent searches stored. It can be found at https://github.com/devjargons/jargons.dev/blob/main/src/lib/stores/search.js
Task
Modify the
$addToRecentSearchesFn
function to ensure that the$recentSearches
state holds a maximum of 5 entries. If the limit is reached, remove the oldest entry before adding a new one.Implementation Steps
$recentSearches
state.$recentSearches
state.Acceptance Criteria
$recentSearches
state should hold a maximum of 5 entries.Additional Information
lib/stores/search.js
file where the$addToRecentSearchesFn
function is defined.The text was updated successfully, but these errors were encountered: