Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix getCollection when collection is empty #8642

Closed

Conversation

TheOtterlord
Copy link
Member

Changes

Fixes getCollection when the collection is empty. 3.1.2 included #8382 which was meant to prevent an error from throwing, and replace it with a warning. The implementation instead returned an Astro integration from getCollection. This PR removes that, and replaces it with a console.warn before returning an empty array.

Other options

  • We could revert the PR entirely,.
  • We can return undefined if we want to explicitely show the collection does not exist.

Testing

The previous PR had testing to confirm it was no longer throwing an error.

Docs

I need to check if docs need updating, but in any case the current behaviour is already undocumented. @Princesseuh did mention that the previous PR deprecated an error, so that will likely also need addressing.

/cc @withastro/maintainers-docs for feedback!

@changeset-bot
Copy link

changeset-bot bot commented Sep 22, 2023

⚠️ No Changeset found

Latest commit: b679391

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Sep 22, 2023
@TheOtterlord
Copy link
Member Author

Haha, looks like I missed #8640
Closing as duplicate!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant