Skip to content

Commit

Permalink
Merge pull request #245 from NYPL/revert-244-DR-3297/rewrite-gethomep…
Browse files Browse the repository at this point in the history
…agedata

Revert "DR-3297: Rewrite getHomePageData to no longer use `items/coun…
  • Loading branch information
7emansell authored Nov 21, 2024
2 parents 08ea410 + 7146277 commit 923b2b2
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 98 deletions.
4 changes: 0 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Update collection links to be relative

### Updated

- Refactor `getHomePageData` to pull item counts from collection endpoints (DR-3297)

## [0.2.0] 2024-11-20

### Removed
Expand Down
2 changes: 1 addition & 1 deletion app/src/components/pages/divisionsPage/divisionsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default function DivisionsPage({ summary, divisions }: DivisionsProps) {
]}
adobeAnalyticsPageName={createAdobeAnalyticsPageName("divisions")}
>
{divisions && divisions?.length > 0 ? (
{divisions && divisions.length > 0 ? (
<>
<Box
sx={{
Expand Down
4 changes: 1 addition & 3 deletions app/src/utils/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import appConfig from "../../../appConfig";
import defaultFeaturedItems from "../data/defaultFeaturedItemData";
import { CARDS_PER_PAGE } from "../config/constants";
import { DC_URL } from "../config/constants";
import { getItemsCountFromCollections } from "./itemCount";

export const getHomePageData = async () => {
const randomNumber = Math.floor(Math.random() * 2);
Expand All @@ -16,8 +15,7 @@ export const getHomePageData = async () => {
const allCollectionUUIDs: string[] = lanes.reduce((acc, lane) => {
return acc.concat(lane.collections.map((collection) => collection.uuid));
}, [] as string[]);
const uuidtoItemCountMap =
await getItemsCountFromCollections(allCollectionUUIDs);
const uuidtoItemCountMap = await getItemsCountFromUUIDs(allCollectionUUIDs);

// Update the collections for each lane with the number of items
const updatedLanes = lanes.map((lane) => {
Expand Down
67 changes: 0 additions & 67 deletions app/src/utils/itemCount.test.tsx

This file was deleted.

23 changes: 0 additions & 23 deletions app/src/utils/itemCount.ts

This file was deleted.

0 comments on commit 923b2b2

Please sign in to comment.