Closed elmeister closed 1 year ago
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
bg-frontend | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Sep 6, 2023 1:44pm |
bhagavad-gita | ✅ Ready (Inspect) | Visit Preview | Sep 6, 2023 1:44pm |
CodeRabbit
This update enhances the safety and reliability of our application by improving the parsing of chapter and verse numbers, and ensuring the presence of the NEXT_PUBLIC_GRAPHQL_ENDPOINT
environment variable before making a request. It gracefully handles edge cases where these parameters are not valid numbers or the environment variable is missing.
File(s) | Summary |
---|---|
src/app/chapter/[chapterNumber]/(chapter)/[[...locale]]/page.tsx ,src/app/chapter/[chapterNumber]/verse/[verseNumber]/[[...locale]]/page.tsx |
The parsing of chapterNumber and verseNumber parameters in both generateMetadata , Chapter functions and getVerseData function call in the Verse component has been modified. Now, it uses Number(chapterNumber) || 1 instead of parseInt(chapterNumber) , adding a fallback value of 1 for chapterNumber and verseNumber if they are not valid numbers. |
src/gqty-client/index.ts |
A check has been added to ensure that the NEXT_PUBLIC_GRAPHQL_ENDPOINT environment variable is present before making a request. If the variable is not present, an error is thrown, enhancing the safety of parsed values in the getVerseData() function. |
🐇💻
In the land of code, where logic intertwines,
We've made some changes, along the lines.
Parsing numbers, with grace and flair,
And checking variables, with utmost care.
So here's to safety, reliability too,
Celebrating changes, from me to you! 🎉
Uplevel your code reviews with CodeRabbit Pro
### CodeRabbit Pro If you like this project, please support us by purchasing the [Pro version](https://coderabbit.ai). The Pro version has advanced context, superior noise reduction and several proprietary improvements compared to the open source version. Moreover, CodeRabbit Pro is free for open source projects.
Summary by CodeRabbit
chapterNumber
andverseNumber
parameters in the Chapter and Verse components. Now, if these parameters are not valid numbers, they will default to 1, ensuring consistent behavior.NEXT_PUBLIC_GRAPHQL_ENDPOINT
environment variable before making a request, preventing potential errors due to missing configuration.