Skip to content

Conversation

@ascorbic
Copy link
Contributor

Changes

Changes the live loader API to use different functions for querying: getLiveEntry and getLiveCollection. Also adds explicit error handling: a loader or a query can return either data or an error.

Testing

Updated existing tests and added new test for error handling

Docs

@changeset-bot
Copy link

changeset-bot bot commented May 23, 2025

⚠️ No Changeset found

Latest commit: 8409c90

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 pkg: astro Related to the core `astro` package (scope) docs pr labels May 23, 2025
@ascorbic ascorbic changed the title Rename LL functions and add error handling feat(live loaders): rename functions and add error handling May 23, 2025
@ascorbic ascorbic force-pushed the live-loader-name branch from 819928f to f2f50f3 Compare May 23, 2025 14:01
@ascorbic ascorbic self-assigned this May 23, 2025
const parsed = await schema.safeParseAsync(entry.data);
if (!parsed.success) {
return {
error: new AstroError({
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure this should return an astro error. We usually keep these to be thrown, not to be used by users. What about a new LiveLoaderError type, like actions?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea

@ascorbic ascorbic requested a review from florian-lefebvre May 28, 2025 15:19
@github-actions github-actions bot added pkg: svelte Related to Svelte (scope) pkg: vue Related to Vue (scope) pkg: react Related to React (scope) pkg: preact Related to Preact (scope) pkg: integration Related to any renderer integration (scope) pkg: create-astro Related to the `create-astro` package (scope) labels May 28, 2025
@github-actions github-actions bot removed pkg: svelte Related to Svelte (scope) pkg: vue Related to Vue (scope) pkg: react Related to React (scope) pkg: preact Related to Preact (scope) pkg: integration Related to any renderer integration (scope) pkg: create-astro Related to the `create-astro` package (scope) labels May 28, 2025
@ascorbic ascorbic merged commit fe042ee into live-loaders May 30, 2025
15 checks passed
@ascorbic ascorbic deleted the live-loader-name branch May 30, 2025 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs pr pkg: astro Related to the core `astro` package (scope)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants