Skip to content

Commit

Permalink
work on fixing vercel timeouts
Browse files Browse the repository at this point in the history
  • Loading branch information
narthur committed Jan 1, 2025
1 parent 4500228 commit 4a0db8d
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 42 deletions.
24 changes: 11 additions & 13 deletions src/components/organisms/passageNavigation/index.graphql
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
fragment passageNavigationChapter on Recording {
id
title
canonicalPath(useFuturePath: true)
collection {
id
contentType
}
}

fragment passageNavigationBook on Sequence {
id
title
recordings(first: 150) {
nodes {
id
title
...andMiniplayer
...passageNavigationChapter
}
}
}
Expand All @@ -19,13 +27,3 @@ fragment passageNavigationVersion on Collection {
}
}
}

fragment passageNavigationChapter on Recording {
id
title
canonicalPath(useFuturePath: true)
collection {
id
contentType
}
}
48 changes: 19 additions & 29 deletions src/lib/getBibles.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import {
CollectionContentType,
Language,
RecordingContentType,
SequenceContentType,
} from '~src/__generated__/graphql';
import pMemoize from 'p-memoize';

import { CollectionContentType, Language } from '~src/__generated__/graphql';
import { BibleIndexProps } from '~src/containers/bible';
import { getAudiobibleIndexData } from '~src/containers/bible/__generated__';
import { BOOK_ID_MAP } from '~src/services/fcbh/constants';
Expand Down Expand Up @@ -49,23 +46,10 @@ async function transform(
.bookId(bookId)
.chapterNumber(bbChapter.number)
.get(),
duration: bbChapter.duration,
recordingContentType: RecordingContentType.BibleChapter,
sequence: {
id: bbChapter.id,
title,
contentType: SequenceContentType.BibleBook,
},
audioFiles: [],
videoFiles: [],
videoStreams: [],
collection: {
id: bible.id,
title: bible.title,
contentType: CollectionContentType.BibleVersion,
},
speakers: [],
sponsor: null,
};
},
);
Expand Down Expand Up @@ -121,14 +105,20 @@ function concatBibles(
);
}

export default async function getBibles(languageId: Language): Promise<{
fcbh: ApiBible[] | null;
api: ApiBible[] | null;
all: ApiBible[];
}> {
const fcbh = await getFcbhBibles(languageId);
const api = await getApiBibles(languageId);
const all = concatBibles(fcbh, api);
const getBibles = pMemoize(
async (
languageId: Language,
): Promise<{
fcbh: ApiBible[] | null;
api: ApiBible[] | null;
all: ApiBible[];
}> => {
const fcbh = await getFcbhBibles(languageId);
const api = await getApiBibles(languageId);
const all = concatBibles(fcbh, api);

return { fcbh, api, all };
}
return { fcbh, api, all };
},
);

export default getBibles;

0 comments on commit 4a0db8d

Please sign in to comment.