Skip to content

Commit

Permalink
Add comment on the implementation not currently being O(1)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewp committed Jan 19, 2023
1 parent d41cc2f commit aa395e4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/astro/src/content/internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ export function createGetEntryBySlug({
collectionToRenderEntryMap: CollectionToEntryMap;
}) {
return async function getEntryBySlug(collection: string, slug: string) {
// This is not an optimized lookup. Should look into an O(1) implementation
// as it's probably that people will have very large collections.
const entries = await getCollection(collection);
let candidate: typeof entries[number] | undefined = undefined;
for(let entry of entries) {
Expand Down

0 comments on commit aa395e4

Please sign in to comment.