Skip to content

refactor: use categories for the loan spotlight - #7257

Merged
eddieferrer merged 3 commits into
mainfrom
CIT-5108_replace_loan_spotlight_queries
Sep 16, 2026
Merged

eddieferrer merged 3 commits into
mainfrom
CIT-5108_replace_loan_spotlight_queries

Conversation

@eddieferrer

Copy link
Copy Markdown
Contributor

Ticket: https://kiva.atlassian.net/browse/CIT-5108

Summary

  • allChannelsQuery becomes allCategoriesQuery, moving from lend.loanChannels to the root browsingCategories field
  • spotlightLoanQuery moves from lend.loanChannelsById to categoriesByIds, reading loans through savedSearch(limit, pageNumber) since categories page rather than offset
  • The operation name spotlightLoanQuery is kept because test/e2e/specs/CategoriesPage.cy.js waits on @gqlspotlightLoanQueryQuery
  • $ids is now [String!]!, so an unresolved slug skips the spotlight query rather than sending a null id
  • Replaces KvLoadingParagraph with KvLoadingText from 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 height

Verification

  • Both queries run against the dev gateway, exercising the resolved, fallback and unresolved slug paths
  • The list query returns 32 browsing categories in roughly 850ms, against 100 channels in roughly 4000ms for the query it replaces
  • Loading placeholder change verified on the dev server

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.
Comment thread src/components/Categories/LoanSpotlight.vue Outdated
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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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...

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mcstover mcstover left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@eddieferrer

Copy link
Copy Markdown
Contributor Author

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.

@eddieferrer
eddieferrer marked this pull request as draft September 15, 2026 16:58
@eddieferrer
eddieferrer marked this pull request as ready for review September 16, 2026 11:12
@eddieferrer
eddieferrer merged commit 7f19595 into main Sep 16, 2026
5 checks passed
@eddieferrer
eddieferrer deleted the CIT-5108_replace_loan_spotlight_queries branch September 16, 2026 11:13
kiva-robot added a commit that referenced this pull request Sep 16, 2026
## [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))
@kiva-robot

Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 3.95.0-rc.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

kiva-robot added a commit that referenced this pull request Sep 16, 2026
## [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)
@kiva-robot

Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 3.95.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants