Skip to content

Update key computation logic in $addToRecentSearchesFn #48

Description

@babblebey

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 😉

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions