Skip to content

Commit

Permalink
fixed bug that broke routing with query params by adjusting lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
wkelly17 committed Feb 8, 2024
1 parent c6aec8e commit 2957c24
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "0.0.1",
"private": true,
"engines": {
"node": "^18"
"node": ">=20.0.0 <22.0.0"
},
"pnpm": {
"updateConfig": {
Expand Down
14 changes: 11 additions & 3 deletions src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,19 @@ export function getBookAndChapterFromUrl({
const firstBibBookChap = chapter || firstBibBook.chapters[0].label
const bookToSearch = book || firstBibBook.slug
// most things in app use slug. But for initial render, its fine to check for if the whole book label was passed instead of only slug
const matchingBook = repoIndex.bible?.find(
//
let matchingBook = repoIndex.bible?.find(
(repoBook) =>
repoBook.slug.toLowerCase() == bookToSearch.toLowerCase() ||
repoBook.label.toLowerCase() == firstBibBook.label.toLowerCase()
repoBook.slug.toLowerCase() == bookToSearch.toLowerCase()
)
if (!matchingBook) {
matchingBook = repoIndex.bible?.find(
(repoBook) =>
repoBook.label.toLowerCase() == firstBibBook.label.toLowerCase()
)
}


const matchingChapter =
matchingBook &&
matchingBook.chapters.find(
Expand Down

0 comments on commit 2957c24

Please sign in to comment.