Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update key computation logic in $addToRecentSearchesFn #48

Open
babblebey opened this issue Apr 19, 2024 · 0 comments
Open

Update key computation logic in $addToRecentSearchesFn #48

babblebey opened this issue Apr 19, 2024 · 0 comments
Labels
↘️ low priority This issue is nice to fix good first issue Good for newcomers

Comments

@babblebey
Copy link
Member

The current logic in the $addToRecentSearchesFn function of /lib/stores/search.js computes the key for recent searches by converting the word to lowercase and replacing spaces with hyphens. This can be improved by using the normalizeAsUrl utility function exported from lib/utils/index.js to ensure consistency and better handling of special characters.

Proposed Changes:

Update the key computation in $addToRecentSearchesFn from:

const lowercaseKey = word.toLowerCase();
const key = lowercaseKey.includes(" ") ? lowercaseKey.split(" ").join("-") : lowercaseKey;

to:

const key = normalizeAsUrl(word);

Related Files:

Additional Information:

  • Nothing much, feel free to ask any question if you need more clarity on the steps to take 😉
@babblebey babblebey added good first issue Good for newcomers ↘️ low priority This issue is nice to fix labels Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
↘️ low priority This issue is nice to fix good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant