Skip to content

Update scrycast extension - #29026

Merged
raycastbot merged 2 commits into
raycast:mainfrom
aayushpi:ext/scrycast
Jun 26, 2026
Merged

raycastbot merged 2 commits into
raycast:mainfrom
aayushpi:ext/scrycast

Conversation

@aayushpi

@aayushpi aayushpi commented Jun 25, 2026 •

Copy link
Copy Markdown
Contributor

Description

  • Improved general performance of search
  • Fixed some errors in search
  • Added support to import commander decks

Screenshot

Screenshot 2026-06-25 at 10 48 57 AM

Checklist

- Merge branch \'contributions/merge-1782409357204\' into contributions/merge-1782409232517
- Pull contributions
- Pull contributions
- Merge pull request raycast#4 from aayushpi/decks
- added support for decks
@aayushpi
aayushpi marked this pull request as ready for review June 25, 2026 17:49
@raycastbot raycastbot added extension fix / improvement Label for PRs with extension's fix improvements extension: scrycast Issues related to the scrycast extension platform: macOS OP is author The OP of the PR is the author of the extension labels Jun 25, 2026
@raycastbot

Copy link
Copy Markdown
Collaborator

Thank you for the update! 🎉

We're currently experiencing a high volume of incoming requests. As a result, the initial review may take up to 15 business days.

@aayushpi aayushpi added extension fix / improvement Label for PRs with extension's fix improvements OP is author The OP of the PR is the author of the extension platform: macOS extension: scrycast Issues related to the scrycast extension labels Jun 25, 2026
@greptile-apps

greptile-apps Bot commented Jun 25, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR centralises Scryfall API access by introducing scryfallFetch, parseScryfallResponse, and SCRYFALL_HEADERS in shared.tsx, then applies them consistently across all fetch call-sites. It also fixes tag-name escaping in tagSearchQuery and adds a commander deck import flow via the existing fetchDeckFromText infrastructure.

  • shared.tsx gains three exports (scryfallFetch, parseScryfallResponse, SCRYFALL_HEADERS) that inject proper User-Agent/Accept headers and parse Scryfall error bodies uniformly; tagSearchQuery now correctly escapes backslashes and double-quotes before embedding values in search strings.
  • All useFetch call-sites in search-view.tsx, my-collection.tsx, browse-sets.tsx, card-views.tsx adopt parseResponse: parseScryfallResponse; manual fetch() call-sites in browse-decks.tsx, set-cards-view.tsx, and cover-fetcher.ts are switched to scryfallFetch.
  • my-collection.tsx gains a rate-limit toast and a collectionIds.length > 0 guard that prevents a redundant collection fetch on first load.

Confidence Score: 4/5

Good infrastructure improvement, but the isNotFound guard in both search-view.tsx and my-collection.tsx is broken by the same parseScryfallResponse change it depends on, causing a spurious error toast on every no-result search.

The isNotFound check keys off err.message.includes("404"), which matched the old bare-useFetch error format. With parseScryfallResponse, the error message is now body.details ("Your query did not return any results.") — the literal "404" never appears. The guard therefore never fires, so every empty-result query shows a "Search failed" toast instead of silently returning no cards. This affects the two most user-facing commands.

search-view.tsx and my-collection.tsx both contain the broken isNotFound check.

Important Files Changed

Filename Overview
extensions/scrycast/src/shared.tsx Adds SCRYFALL_HEADERS, scryfallFetch, and parseScryfallResponse centralising header injection and error parsing; also fixes backslash/quote escaping in tagSearchQuery and deduplicates tagScryfallSearchUrl logic.
extensions/scrycast/src/search-view.tsx Adopts parseScryfallResponse and new headers, but isNotFound check (includes("404")) is now dead code — Scryfall's 404 detail string never contains the literal "404", breaking the guard that suppresses spurious error toasts on empty searches.
extensions/scrycast/src/my-collection.tsx Adds proper headers and parseScryfallResponse; guards empty-collection fetch (collectionIds.length > 0); but carries the same broken isNotFound check as search-view.tsx, causing toast noise on no-result searches.
extensions/scrycast/src/browse-decks.tsx All three fetch() calls replaced with scryfallFetch + SCRYFALL_API_BASE; no logic changes to deck parsing or commander/section handling.
extensions/scrycast/src/browse-sets.tsx Switches useFetch to use SCRYFALL_HEADERS and parseScryfallResponse; adopts SCRYFALL_API_BASE constant throughout.
extensions/scrycast/src/card-views.tsx Adds SCRYFALL_HEADERS and parseScryfallResponse to the prints useFetch call and replaces the hardcoded URL with SCRYFALL_API_BASE.
extensions/scrycast/src/cover-fetcher.ts Replaces fetch() with scryfallFetch() and the hardcoded URL with SCRYFALL_API_BASE; rate-limit handling logic unchanged.
extensions/scrycast/src/set-cards-view.tsx Switches fetchWithRetry to scryfallFetch and uses SCRYFALL_API_BASE for the search URL; retry and pagination logic untouched.
extensions/scrycast/CHANGELOG.md Adds an entry for the commander deck import and Scryfall header fix under the existing unreleased section.
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
extensions/scrycast/src/search-view.tsx:87-88
**`isNotFound` guard broken after introducing `parseScryfallResponse`**

`parseScryfallResponse` throws `new Error(body.details)` — for Scryfall's 404 (no results) the detail string is `"Your query did not return any results."`, which contains neither `"404"` nor `"No cards found"`. With the old bare `useFetch`, `err.message` included the raw status code, so `includes("404")` matched. Now `isNotFound` is always `false` for empty searches, causing the `!isNotFound && !isBadSyntax` branch to fire and show a **"Search failed"** toast every time the user types a query that returns zero cards.

The same regression exists in `my-collection.tsx` line 131 where `isNotFound` is constructed identically. Both checks should key off the detail string instead (e.g. `err.message.includes("Your query did not return any results")`) or check `err.message.includes("not_found")` / a status-code property if available.

Reviews (2): Last reviewed commit: "Update CHANGELOG.md, add platforms field..." | Re-trigger Greptile

Comment thread extensions/scrycast/CHANGELOG.md Outdated
@@ -1,14 +1,19 @@
## [Unreleased] - 2026-05-11
## [Unreleased] - {PR_MERGE_DATE}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Per Raycast changelog conventions, non-initial-release entries should use a descriptive label such as [Update] rather than [Unreleased]. The {PR_MERGE_DATE} placeholder is correct and should stay as-is.

Suggested change
## [Unreleased] - {PR_MERGE_DATE}
## [Update] - {PR_MERGE_DATE}

Rule Used: What: Changelog entries must use {PR_MERGE_DATE}... (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: extensions/scrycast/CHANGELOG.md
Line: 1

Comment:
Per Raycast changelog conventions, non-initial-release entries should use a descriptive label such as `[Update]` rather than `[Unreleased]`. The `{PR_MERGE_DATE}` placeholder is correct and should stay as-is.

```suggestion
## [Update] - {PR_MERGE_DATE}
```

**Rule Used:** What: Changelog entries must use `{PR_MERGE_DATE}`... ([source](https://app.greptile.com/raycast/-/custom-context?memory=c2214c11-df56-490a-b1c0-09a385df481a))

How can I resolve this? If you propose a fix, please make it concise.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Comment on lines +96 to +100
const isBadSyntax =
err.message.includes("400") ||
err.message.includes("invalid") ||
err.message.includes("ignored") ||
err.message.includes("Bad Request");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 With parseScryfallResponse in place, the error message is now Scryfall's body.details string (e.g. "Your query is too broad"), not the raw HTTP response text. The "400" and "Bad Request" substrings can therefore never appear in err.message, making those two checks dead code. The meaningful guards are "invalid" and "ignored".

Suggested change
const isBadSyntax =
err.message.includes("400") ||
err.message.includes("invalid") ||
err.message.includes("ignored") ||
err.message.includes("Bad Request");
const isBadSyntax =
err.message.includes("invalid") ||
err.message.includes("ignored");
Prompt To Fix With AI
This is a comment left during a code review.
Path: extensions/scrycast/src/search-view.tsx
Line: 96-100

Comment:
With `parseScryfallResponse` in place, the error message is now Scryfall's `body.details` string (e.g. `"Your query is too broad"`), not the raw HTTP response text. The `"400"` and `"Bad Request"` substrings can therefore never appear in `err.message`, making those two checks dead code. The meaningful guards are `"invalid"` and `"ignored"`.

```suggestion
        const isBadSyntax =
          err.message.includes("invalid") ||
          err.message.includes("ignored");
```

How can I resolve this? If you propose a fix, please make it concise.

@0xdhrv 0xdhrv self-assigned this Jun 26, 2026

@0xdhrv 0xdhrv left a comment

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.

Looks good to me, approved ✅

@raycastbot
raycastbot merged commit 92fccb3 into raycast:main Jun 26, 2026
2 of 3 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

@raycastbot

Copy link
Copy Markdown
Collaborator

🎉 🎉 🎉

We've rewarded your Raycast account with some credits. You will soon be able to exchange them for some swag.

Comment on lines 87 to +88
const { isLoading, data } = useFetch<ScryfallSearchResponse>(
`https://api.scryfall.com/cards/search?q=${encodeURIComponent(debouncedSearchText)}&unique=cards`,
`${SCRYFALL_API_BASE}/cards/search?q=${encodeURIComponent(debouncedSearchText)}&unique=cards`,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 isNotFound guard broken after introducing parseScryfallResponse

parseScryfallResponse throws new Error(body.details) — for Scryfall's 404 (no results) the detail string is "Your query did not return any results.", which contains neither "404" nor "No cards found". With the old bare useFetch, err.message included the raw status code, so includes("404") matched. Now isNotFound is always false for empty searches, causing the !isNotFound && !isBadSyntax branch to fire and show a "Search failed" toast every time the user types a query that returns zero cards.

The same regression exists in my-collection.tsx line 131 where isNotFound is constructed identically. Both checks should key off the detail string instead (e.g. err.message.includes("Your query did not return any results")) or check err.message.includes("not_found") / a status-code property if available.

Prompt To Fix With AI
This is a comment left during a code review.
Path: extensions/scrycast/src/search-view.tsx
Line: 87-88

Comment:
**`isNotFound` guard broken after introducing `parseScryfallResponse`**

`parseScryfallResponse` throws `new Error(body.details)` — for Scryfall's 404 (no results) the detail string is `"Your query did not return any results."`, which contains neither `"404"` nor `"No cards found"`. With the old bare `useFetch`, `err.message` included the raw status code, so `includes("404")` matched. Now `isNotFound` is always `false` for empty searches, causing the `!isNotFound && !isBadSyntax` branch to fire and show a **"Search failed"** toast every time the user types a query that returns zero cards.

The same regression exists in `my-collection.tsx` line 131 where `isNotFound` is constructed identically. Both checks should key off the detail string instead (e.g. `err.message.includes("Your query did not return any results")`) or check `err.message.includes("not_found")` / a status-code property if available.

How can I resolve this? If you propose a fix, please make it concise.

almatkai pushed a commit to almatkai/raymes-extensions that referenced this pull request Jul 13, 2026
* Update scrycast extension

- Merge branch \'contributions/merge-1782409357204\' into contributions/merge-1782409232517
- Pull contributions
- Pull contributions
- Merge pull request raycast#4 from aayushpi/decks
- added support for decks

* Update CHANGELOG.md, add platforms field and optimise images

---------

Co-authored-by: raycastbot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extension fix / improvement Label for PRs with extension's fix improvements extension: scrycast Issues related to the scrycast extension OP is author The OP of the PR is the author of the extension platform: macOS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants