Fix bookmark searching logic

This commit is contained in:
Jason Henriquez 2024-04-22 20:02:36 -05:00
parent e60cd786e9
commit c254875e2e
2 changed files with 5 additions and 5 deletions

View File

@ -102,7 +102,7 @@ export default defineComponent({
},
matchingBookmarksDataList: function () {
return this.$store.getters.getPageBookmarksWithRouteSubstring(this.lastSuggestionQuery, this.currentRouteFullPath)
return this.$store.getters.getPageBookmarksMatchingQuery(this.lastSuggestionQuery, this.currentRouteFullPath)
},
pageBookmarkIconTitle: function () {

View File

@ -14,13 +14,13 @@ const getters = {
return pageBookmark
},
getPageBookmarksWithRouteSubstring: (state) => (routeSubstring, routeToExclude) => {
if (routeSubstring === '') {
getPageBookmarksMatchingQuery: (state) => (query, routeToExclude) => {
if (query === '') {
return []
}
const routeSubstringToLower = routeSubstring.toLowerCase()
const queryToLower = query.toLowerCase()
const pageBookmarks = state.pageBookmarks.filter((pageBookmark) =>
pageBookmark && pageBookmark.route.toLowerCase().includes(routeSubstringToLower) && pageBookmark.route !== routeToExclude
pageBookmark && pageBookmark.bookmarkName.toLowerCase().includes(queryToLower) && pageBookmark.route !== routeToExclude
)
return pageBookmarks
}