Skip to content

Update stock-tracker extension#27549

Merged
raycastbot merged 4 commits intoraycast:mainfrom
vinayh:stock-tracker-improvements
Apr 30, 2026
Merged

Update stock-tracker extension#27549
raycastbot merged 4 commits intoraycast:mainfrom
vinayh:stock-tracker-improvements

Conversation

@vinayh
Copy link
Copy Markdown
Contributor

@vinayh vinayh commented Apr 30, 2026

Hello!

I've been using this extension regularly over the past few weeks and thought I should contribute back some minor fixes and (IMO) UX improvements. All were AI-assisted and human-verified.

Summary

  • New: pre/post-market indicator (sunrise/moon icon) on rows showing extended-hours prices.
  • New: ★ next to a search-result symbol when it's already in your favorites.
  • New: last-updated timestamp shown next to the Favorites / Search Results section header.
  • Fix: "Move Down in Favorites" was a no-op for the last item; both move actions now guard against missing symbols too.
  • Fix: prices of 0 were rendering as the missing-value placeholder; negative values now scale with k/M/B/T suffixes.
  • Robustness: refresh Yahoo Finance cookie/crumb proactively after 12 h instead of waiting for a request to fail.
  • Robustness: only refresh cookie/crumb on 401/403 (was previously refreshing on any 4xx/5xx, including 404/5xx).
  • Robustness: fix Set-Cookie parsing under native fetch (use getSetCookie()) and thread AbortSignal through cookie/crumb fetches.
  • Robustness: cancel in-flight requests on view unmount.
  • Robustness: recover gracefully from corrupted local-storage values (favorites + cached cookie/crumb).
  • Internal: switch to native fetch, removing the punycode deprecation warning. Update @raycast/api, TypeScript, ESLint, and other dependencies; migrate to ESLint flat config.
  • Internal: lift useFavorites / useStockInfo / useStockSearch to the top-level Command() for a single source of truth (eliminates duplicate LocalStorage loads on each search/clear toggle).

Test plan

  • npm run build passes
  • npm run lint passes (only the pre-existing @raycast/prefer-title-case warning, which is a false positive on "Move Up in Favorites")
  • Verified in Raycast (npm run dev): favorites view, search, add/remove favorite, move up/down, detail panel, last-updated timestamp, market-state icons, ★ on already-favorited search results

- Show sunrise/moon icon on rows with pre/post-market prices
- Show a star next to symbol in search results when already in Favorites
- Show last-updated timestamp next to section headers
- Fix "Move Down in Favorites" no-op for last item; guard missing symbols
- Fix prices of 0 not rendering; scale negative values correctly
- Refresh Yahoo cookie/crumb proactively after 12h
- Only refresh cookie/crumb on 401/403 (was any 4xx/5xx)
- Fix Set-Cookie parsing under native fetch
- Thread AbortSignal through cookie/crumb fetches
- Cancel in-flight requests on unmount
- Recover gracefully from corrupted local-storage values
- Switch to native fetch (removes punycode deprecation warning)
- Update @raycast/api, TypeScript, ESLint, and other dependencies

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@raycastbot raycastbot added extension fix / improvement Label for PRs with extension's fix improvements extension: stock-tracker Issues related to the stock-tracker extension platform: macOS labels Apr 30, 2026
@raycastbot
Copy link
Copy Markdown
Collaborator

raycastbot commented Apr 30, 2026

Thank you for your first contribution! 🎉

🔔 @hmarr @ericchernuka @MeleMannen you might want to have a look.

You can use this guide to learn how to check out the Pull Request locally in order to test it.

📋 Quick checkout commands
BRANCH="stock-tracker-improvements"
FORK_URL="https://github.com/vinayh/raycast-extensions.git"
EXTENSION_NAME="stock-tracker"
REPO_NAME="raycast-extensions"

git clone -n --depth=1 --filter=tree:0 -b $BRANCH $FORK_URL
cd $REPO_NAME
git sparse-checkout set --no-cone "extensions/$EXTENSION_NAME"
git checkout
cd "extensions/$EXTENSION_NAME"
npm install && npm run dev

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

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 30, 2026

Greptile Summary

This PR makes a broad set of improvements to the stock-tracker extension: new UX indicators (pre/post-market icons, ★ for favorited symbols, last-updated timestamp), several bug fixes (formatMoney for zero/negative values, moveDown no-op, move-guard for missing symbols), and robustness improvements (native fetch, getSetCookie() fix, proactive cookie refresh, abort on unmount, corrupt-storage recovery). The architectural refactor lifting all hooks to Command() is clean and correct.

  • The CHANGELOG entry uses a hardcoded date (2026-04-30) instead of the required {PR_MERGE_DATE} placeholder — this must be changed before merge.

Confidence Score: 4/5

Safe to merge after fixing the CHANGELOG date placeholder.

One P1 finding: the CHANGELOG entry uses a hardcoded date instead of {PR_MERGE_DATE}, violating the repository's required convention. All source code changes are well-reasoned and an improvement over the previous implementation.

extensions/stock-tracker/CHANGELOG.md — fix the hardcoded date to {PR_MERGE_DATE}.

Important Files Changed

Filename Overview
extensions/stock-tracker/CHANGELOG.md New [Improvements] entry uses a hardcoded date instead of the required {PR_MERGE_DATE} placeholder.
extensions/stock-tracker/src/yahoo-finance/client.ts Switches to native fetch, fixes Set-Cookie parsing with getSetCookie(), threads AbortSignal, adds proactive 12h cache expiry, tightens retry to 401/403; getCookie is missing a response.ok check unlike getCrumb.
extensions/stock-tracker/src/use-stock-info.ts Adds lastUpdated, stable symbolsKey memo, cleanup abort on unmount, and better error handling with finally; logic is correct.
extensions/stock-tracker/src/favorites-store.ts Unifies moveUp/moveDown into a single move(delta) helper, guards against missing symbols, and adds safe JSON parsing for corrupted storage.
extensions/stock-tracker/src/index.tsx Lifts all hooks to the top-level command, eliminating duplicate LocalStorage loads and providing a single source of truth for favorites/search state.
extensions/stock-tracker/src/stock-list-item.tsx Adds pre/post-market icon accessory and optional ★ favorite indicator; changes are safe.
extensions/stock-tracker/src/yahoo-finance/quote.ts Expands marketState union to include PREPRE/POSTPOST/CLOSED; error typed as unknown.
extensions/stock-tracker/package.json Removes cross-fetch, upgrades @raycast/api and dev tools, adds platforms: ["macOS"].
Prompt To Fix All With AI
Fix the following 2 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 2
extensions/stock-tracker/CHANGELOG.md:3
**Hardcoded date should be `{PR_MERGE_DATE}`**

The changelog entry uses a hardcoded date (`2026-04-30`) instead of the `{PR_MERGE_DATE}` template variable. The placeholder is automatically replaced with the actual merge date when the PR is merged — using a real date bypasses that mechanism.

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

### Issue 2 of 2
extensions/stock-tracker/src/yahoo-finance/client.ts:108-121
**`getCookie` does not check `response.ok`**

`getCrumb` was updated to check `response.ok` and throw a descriptive error, but `getCookie` was not given the same treatment. If `https://fc.yahoo.com` returns a non-2xx status, the code silently falls through to parsing `Set-Cookie` headers and then throws the generic "Failed to fetch cookie" message, making it hard to diagnose the real failure.

```suggestion
async function getCookie(signal: AbortSignal): Promise<string> {
  const response = await fetch("https://fc.yahoo.com", { headers: HEADERS, signal });
  if (!response.ok) {
    throw new Error(`Failed to fetch cookie: ${response.status} ${response.statusText}`);
  }
```

Reviews (4): Last reviewed commit: "Update CHANGELOG.md and add platforms fi..." | Re-trigger Greptile

Comment thread extensions/stock-tracker/eslint.config.js Outdated
vinayh and others added 2 commits April 30, 2026 13:40
…slint plugin

Defer entirely to @raycast/eslint-config (the declared devDependency).
defineConfig from eslint/config flattens the nested array that
@raycast/eslint-config currently emits, so we no longer need to
inline the composition or import @raycast/eslint-plugin directly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ney suffix bound

- getCrumb now throws on non-2xx instead of caching an HTML error page as
  a "crumb" string (which would cause the next request to fail with 401/403
  and waste a round trip plus poison the cache for up to 12h).
- formatMoney clamps the magnitude to the suffix table length so values
  >= 1e15 render as "1000.00T" rather than "1000.00undefined".

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@MeleMannen MeleMannen left a comment

Choose a reason for hiding this comment

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

Good changes! LGTM!

@raycast-extensions-bot raycast-extensions-bot Bot added the Approved Approved by a user label Apr 30, 2026
@0xdhrv 0xdhrv self-assigned this Apr 30, 2026
Copy link
Copy Markdown
Contributor

@0xdhrv 0xdhrv left a comment

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 5df3917 into raycast:main Apr 30, 2026
3 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

Published to the Raycast Store:
https://raycast.com/hmarr/stock-tracker

@raycastbot
Copy link
Copy Markdown
Collaborator

🎉 🎉 🎉

Such a great contribution deserves a reward, but unfortunately we couldn't find your Raycast account based on your GitHub username (@vinayh).

Please link your GitHub account to your Raycast account to receive your credits and soon be able to exchange them for some swag.

@@ -1,5 +1,19 @@
# Stock Tracker Changelog

## [Improvements] - 2026-04-30
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 Hardcoded date should be {PR_MERGE_DATE}

The changelog entry uses a hardcoded date (2026-04-30) instead of the {PR_MERGE_DATE} template variable. The placeholder is automatically replaced with the actual merge date when the PR is merged — using a real date bypasses that mechanism.

Suggested change
## [Improvements] - 2026-04-30
## [Improvements] - {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/stock-tracker/CHANGELOG.md
Line: 3

Comment:
**Hardcoded date should be `{PR_MERGE_DATE}`**

The changelog entry uses a hardcoded date (`2026-04-30`) instead of the `{PR_MERGE_DATE}` template variable. The placeholder is automatically replaced with the actual merge date when the PR is merged — using a real date bypasses that mechanism.

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

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Approved Approved by a user extension fix / improvement Label for PRs with extension's fix improvements extension: stock-tracker Issues related to the stock-tracker extension platform: macOS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants