Skip to content

Update Vercast extension - update components + proper handling when token invalid#17429

Merged
raycastbot merged 4 commits intoraycast:mainfrom
xmok:ext/vercast-components
Mar 12, 2025
Merged

Update Vercast extension - update components + proper handling when token invalid#17429
raycastbot merged 4 commits intoraycast:mainfrom
xmok:ext/vercast-components

Conversation

@xmok
Copy link
Contributor

@xmok xmok commented Feb 28, 2025

Description

My Vercel token expired which caused the extension to crash and show never-ending loading indicators. We now wrap the main components in a WithAccessToken that calls isValidToken and shows the relevant view. To ensure that token is valid, we call the fetchUser function.

As a bonus: updated all components in "Search Components"

  • Update items in Search Components
  • Fix extension stuck loading when Token Length is invalid
  • Fix extension would crash when Token invalid

Screencast

Here are 3 screencasts showing the changes (before and after):

INVALID TOKEN LENGTH (notice the infinite loading)

vercast-invalid-token-length.mp4

CORRECT LENGTH BUT INVAILD/EXPIRED TOKEN

vercast-invalid-token.mp4

NEW COMPONENTS

vercast-components.mp4

Checklist

@xmok xmok requested a review from samuelkraft as a code owner February 28, 2025 09:52
@raycastbot raycastbot added extension fix / improvement Label for PRs with extension's fix improvements extension: vercast Issues related to the vercast extension OP is contributor The OP of the PR is a contributor of the extension labels Feb 28, 2025
@raycastbot
Copy link
Collaborator

raycastbot commented Feb 28, 2025

Thank you for your contribution! 🎉

🔔 @MaxLeiter @gleich @dgrcode @samuelkraft 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.

Due to our current reduced availability, the initial review may take up to 10-15 business days

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR improves error handling for invalid tokens in the Vercast extension and updates the components list to match Vercel's current Geist design system.

  • Added new WithValidToken component in /extensions/vercast/src/pages/with-valid-token.tsx that properly handles loading states and displays an error view when token validation fails
  • Added InvalidTokenView component in /extensions/vercast/src/pages/details/invalid-token-view.tsx to show a clear error message with a button to open preferences
  • Updated isValidToken utility in /extensions/vercast/src/utils/is-valid-token.ts to properly validate tokens by fetching user data asynchronously
  • Updated the components list in /extensions/vercast/src/search-components.tsx to match Vercel's current Geist design system
  • Added version 2.9 to /extensions/vercast/CHANGELOG.md with the required {PR_MERGE_DATE} template string

10 file(s) reviewed, 3 comment(s)
Edit PR Review Bot Settings | Greptile

@pernielsentikaer pernielsentikaer self-assigned this Feb 28, 2025
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

(updates since last review)

This PR enhances the Vercast extension's error handling for invalid tokens by using the usePromise hook from @raycast/utils with failureToastOptions for cleaner error management.

  • Improved error messaging in /extensions/vercast/src/utils/is-valid-token.ts with specific error messages for token length and validation failures
  • Simplified error handling in WithValidToken component by leveraging built-in toast functionality from @raycast/utils
  • Removed unnecessary imports (showToast and Toast) as they're replaced by the more elegant failureToastOptions approach

3 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

@pernielsentikaer
Copy link
Collaborator

@MaxLeiter do you want to check this?

@raycastbot raycastbot merged commit 6347ea2 into raycast:main Mar 12, 2025
2 checks passed
@github-actions
Copy link
Contributor

Published to the Raycast Store:
https://raycast.com/vercel/vercast

@raycastbot
Copy link
Collaborator

🎉 🎉 🎉

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

@xmok xmok deleted the ext/vercast-components branch March 12, 2025 11:30
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: vercast Issues related to the vercast extension OP is contributor The OP of the PR is a contributor of the extension

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants