refactor: use categories for the loan spotlight - #7257
Conversation
The spotlight moves off the deprecated lend.loanChannels and lend.loanChannelsById to browsingCategories and categoriesByIds, reading loans through each category's savedSearch. Category ids are non-null strings, so an unresolved slug now skips the spotlight query instead of sending a null id.
KvLoadingParagraph hardcodes 1rem lines, so the spotlight skeleton rendered taller than the text it stands in for and overflowed its own 5.5rem height. KvLoadingText from kv-components sizes lines from the surrounding text and matches the paragraph's five line clamp.
savedSearch is nullable, so comparing totalCount to 0 let an absent saved search skip the fallback and render an empty spotlight. A falsy check covers the missing and zero cases together.
| loanChannel => loanChannel.url.split('/').pop() === routePath | ||
| function filterCategoriesForRoute(routePath, categories) { | ||
| const filteredCategories = categories.filter( | ||
| category => category.url.split('/').pop() === routePath |
There was a problem hiding this comment.
@eddieferrer @meganmcmillan Wondering if the forthcoming query to get category by slug will help use skip the "getAllCategories" query in this component. This seems quite inefficient at present to have to call for all categories when it's loaded...
There was a problem hiding this comment.
Yes, it looks like that will help here - we will provide a way to look up by the routePath/slug so you can get the one category you want.
There was a problem hiding this comment.
mcstover
left a comment
There was a problem hiding this comment.
Probably be a little faster, but more expensive to query all categories than all loan channels but hopefully we can find a better way soon.
Its actually over 3x faster with the new query! I can just keep this open until we get the slug lookup. |
## [3.95.0-rc.2](v3.95.0-rc.1...v3.95.0-rc.2) (2026-09-16) ### 🎉 New Features * additional fix on unit tests ([5f197ed](5f197ed)) * fixed unit test error ([589df65](589df65)) * header inclusion and unit test revision ([a8c1b4c](a8c1b4c)) * including background image ([8337659](8337659)) * overall card redesign ([3d717a2](3d717a2)) * resized image, revised tailwinds css classes ([0e5e6e7](0e5e6e7)) ### 🐛 Bugfixes * use utm_content for badge modal on lending stats ([#7263](#7263)) ([391a3e4](391a3e4)) ### 🪚 Refactors * use categories for the loan spotlight ([#7257](#7257)) ([7f19595](7f19595)) ### 🧹 Chores * **header:** delete the legacy default header branch ([0e4127c](0e4127c)) * **header:** delete the orphaned legacy header component tree ([566ed79](566ed79))
|
🎉 This PR is included in version 3.95.0-rc.2 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
## [3.95.0](v3.94.0...v3.95.0) (2026-09-16) ### 🎉 New Features * additional fix on unit tests ([5f197ed](5f197ed)) * fixed unit test error ([589df65](589df65)) * header inclusion and unit test revision ([a8c1b4c](a8c1b4c)) * including background image ([8337659](8337659)) * **MP-3159:** a/b test express vs non express checkout ([a7cefb5](a7cefb5)) * overall card redesign ([3d717a2](3d717a2)) * resized image, revised tailwinds css classes ([0e5e6e7](0e5e6e7)) ### 🐛 Bugfixes * use flag to handle watch and remove express checkout enabled flag ([a9da6c7](a9da6c7)) * use utm_content for badge modal on lending stats ([#7263](#7263)) ([391a3e4](391a3e4)) ### 🪚 Refactors * **contentful:** move operations onto cacheable typed fields ([68cd06a](68cd06a)) * use categories for the loan spotlight ([#7257](#7257)) ([7f19595](7f19595)) ### 🔍 Tests * **contentfulUtils:** cover getContentfulEntries ([873d509](873d509)) ### 🧹 Chores * **contentful:** remove unused checkout donation query ([92a11fc](92a11fc)) * **header:** delete the legacy default header branch ([0e4127c](0e4127c)) * **header:** delete the orphaned legacy header component tree ([566ed79](566ed79)) * **release:** 3.95.0-rc.1 [skip ci] ([7b65f32](7b65f32)) * **release:** 3.95.0-rc.2 [skip ci] ([af69e36](af69e36)), closes [#7263](#7263) [#7257](#7257)
|
🎉 This PR is included in version 3.95.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Ticket: https://kiva.atlassian.net/browse/CIT-5108
Summary
allChannelsQuerybecomesallCategoriesQuery, moving fromlend.loanChannelsto the rootbrowsingCategoriesfieldspotlightLoanQuerymoves fromlend.loanChannelsByIdtocategoriesByIds, reading loans throughsavedSearch(limit, pageNumber)since categories page rather than offsetspotlightLoanQueryis kept becausetest/e2e/specs/CategoriesPage.cy.jswaits on@gqlspotlightLoanQueryQuery$idsis now[String!]!, so an unresolved slug skips the spotlight query rather than sending a null idKvLoadingParagraphwithKvLoadingTextfrom kv-components in the spotlight: the old component hardcodes 1rem lines, so the skeleton rendered taller than the text it stands in for and overflowed its own 5.5rem heightVerification