Repository navigation
refactor(shopify-assets): replace axios with fetch - #2261
Merged
Merged
Conversation
🦋 Changeset detectedLatest commit: c017398 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
✅ E2E Tests🟢 45 passed • 🟡 1 flaky • view full report • view run Studio: https://plugins-e2e-test-studio-mq2wj51we.sanity.dev Datasets: |
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||
Co-authored-by: Pedro Bonamin <pedrobonamin@users.noreply.github.com>
mockClear keeps unconsumed mockImplementationOnce overrides, which would leak into the next test. mockReset drops them and restores the default response. Co-authored-by: Pedro Bonamin <pedrobonamin@users.noreply.github.com>
…etch The fetch observable emits a single value, so distinctUntilChanged never filters anything. Co-authored-by: Pedro Bonamin <pedrobonamin@users.noreply.github.com>
cursor
Bot
force-pushed
the
cursor/shopify-assets-drop-axios-8924
branch
from
November 2, 2026 07:37
fc374d5 to
c017398
Compare
juice49
approved these changes
Nov 2, 2026
Merged
pedrobonamin
pushed a commit
that referenced
this pull request
Nov 2, 2026
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## sanity-plugin-shopify-assets@2.1.1 ### Patch Changes - [#2261](#2261) [`854288a`](854288a) Thanks [@pedrobonamin](https://github.com/pedrobonamin)! - Replace `axios` with the native `fetch` API. In-flight asset requests are now aborted when a newer search supersedes them. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Release metadata only in this diff; the underlying change is a localized HTTP client swap with request cancellation in the Shopify assets plugin. > > **Overview** > This is a **Changesets release PR** that publishes **sanity-plugin-shopify-assets@2.1.1** to npm. It bumps the package version from `2.1.0` to `2.1.1`, adds the corresponding **CHANGELOG** entry, and removes the consumed changeset file. > > The release notes document the patch from [#2261](#2261): Shopify asset HTTP calls now use the **native `fetch` API** instead of **`axios`**, and **in-flight requests are aborted** when a newer asset search replaces them—reducing stale results and dropping the `axios` dependency from the package. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit d6968b4. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> Co-authored-by: squiggler-app[bot] <265501495+squiggler-app[bot]@users.noreply.github.com>
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
sanity-plugin-shopify-assetsonly usedaxiosfor two plain GET requests to the Sanity Shopify assets endpoint. It has been there since the plugin's first commit in the original standalone repo. Nothing in the code depends on axios features: no interceptors, retries, upload progress, or Node-specific behavior.Changes
fromFetchfromrxjs/fetch.rxjsis already a dependency, so no new package is added.withCredentials: truebecomescredentials: 'include', and the bearer token header is unchanged.fetchdoesn't. To keep the same behavior, the selector throws anErrorthat uses the API body'smessage, orRequest failed with status code Nwhen there is none.ShopifyAssetPickernow just readserr.messageinstead oferr.response?.data?.message.fromFetchaborts the in-flight request whenswitchMapmoves on to a newer query. Before, axios insidedeferkept the superseded request running even though its result was ignored.axiosis removed from the plugin's dependencies. The lockfile only loses this importer's entry. axios stays in the tree because@bynder/compact-viewand others still use it. The lockfile was edited by hand on purpose: a plainpnpm installwould also bump the Studionextoverrides (see AGENTS.md).pnpm install --frozen-lockfilepasses.Unrelated cleanup
The search request no longer pipes through
distinctUntilChanged(). This is mostly unrelated to the axios removal: the request emits a single value, so the operator never filtered anything, and that was already true with axios. It came up while reviewing this PR and is in its own commit, so it can be dropped or split out if preferred.Tests
The existing regression test now stubs
fetchinstead of mocking axios. The mock is reset withmockReset()after each test, so an unusedmockImplementationOncecan't leak into the next one. New tests cover:credentials: 'include'and theAuthorizationheaderpnpm format,pnpm lint,pnpm knip, the plugin build and its Vitest suite all pass locally. The live Shopify endpoint wasn't exercised; that needs a project with Shopify connected.Note
Low Risk
Scoped HTTP client swap in one plugin with preserved auth and error UX; behavior change is mainly aborting stale searches during rapid typing.
Reviewed by Cursor Bugbot for commit f0a1fce. Configure here.