Skip to content

fix: read dataset and canvas resources#103

Merged
cngonzalez merged 2 commits intomainfrom
fix/sdk-1088/read-dataset-and-canvas-resources
Mar 30, 2026
Merged

fix: read dataset and canvas resources#103
cngonzalez merged 2 commits intomainfrom
fix/sdk-1088/read-dataset-and-canvas-resources

Conversation

@cngonzalez
Copy link
Copy Markdown
Member

Description

As the SDK moves to using global resources for everything, it would be great for consistency if we pass the same client around to our image builder as well. This PR extends the existing Media Library logic for resources to dataset and canvas resources.

What to review

This should hopefully be pretty straightforward. Are there any places I failed to update?

Testing

Tests were added.

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 30, 2026

🦋 Changeset detected

Latest commit: 488b9c2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sanity/image-url Patch

Not sure what this means? Click here to learn what changesets are.

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

@cngonzalez cngonzalez force-pushed the fix/sdk-1088/read-dataset-and-canvas-resources branch from 71654c4 to c54e44d Compare March 30, 2026 13:52
@cngonzalez cngonzalez marked this pull request as ready for review March 30, 2026 13:58
@cngonzalez cngonzalez requested review from rdunk and sgulseth March 30, 2026 13:58
Copy link
Copy Markdown
Member

@rdunk rdunk left a comment

Choose a reason for hiding this comment

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

LGTM, just one small question/comment.

throw new Error('Dataset clients must include an id in "resource"')
}

const [resourceProjectId, resourceDataset] = resource.id.split('.')
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

My only feedback/question would be: is it worth adding extra basic validation here to ensure the ID includes both segments? This handler uniquely depends on the resource ID being a specific shape, so an ID without a . wouldn't produce a "structurally coherent" URL (one with all the segments), whereas the others would and will just 404.

Definitely non-blocking though, just a thought.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good call, have added some validation. Thanks!

@cngonzalez cngonzalez merged commit 135943c into main Mar 30, 2026
4 checks passed
@cngonzalez cngonzalez deleted the fix/sdk-1088/read-dataset-and-canvas-resources branch March 30, 2026 17:35
@squiggler-app squiggler-app bot mentioned this pull request Mar 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants