Repository navigation
Update SwitchHosts extension - modernize + icons + markdown + add hook + remove setTimeout,node-fetch - #21017
Conversation
|
Thank you for your contribution! 🎉 🔔 @tiancheng92 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 during summer, the initial review may take up to 10-15 business days. |
left a comment
There was a problem hiding this comment.
Greptile Summary
This PR comprehensively modernizes the SwitchHosts extension to align with current Raycast development standards. The changes include migrating from the deprecated .eslintrc.json to the modern eslint.config.js flat config format using @raycast/eslint-config. The codebase has been updated to use the useCachedPromise hook from @raycast/utils instead of manual state management with useState and useEffect, providing built-in caching, loading states, and better error handling.
The extension removes the node-fetch dependency in favor of native fetch, which is now available in modern Node.js versions. TypeScript configuration has been upgraded from ES2020 to ES2023, enabling access to newer JavaScript features and APIs. The UI has been enhanced with type-based icons for different host configurations (folder, group, remote, local) and improved accessories for better visual distinction.
Documentation improvements include adding a proper README.md file and CHANGELOG.md with historical entries dating back to 2021. The extension has been categorized as "Developer Tools" and includes metadata images for store submission. Package.json scripts have been standardized to include modern Raycast tooling commands like lint, fix-lint, and publish. The main functionality switches between different host configurations while preserving the URL path, now with optimistic updates for a more responsive user experience.
Important Files Changed
| Filename | Score | Overview |
|---|---|---|
extensions/switchhosts/src/switchhosts.tsx |
3/5 | Modernized with useCachedPromise hook and optimistic updates, but has potential UI state consistency issues |
extensions/switchhosts/package.json |
5/5 | Updated dependencies, added categories, modernized scripts, and removed node-fetch dependency |
extensions/switchhosts/eslint.config.js |
4/5 | Added modern ESLint flat config using @raycast/eslint-config |
extensions/switchhosts/tsconfig.json |
5/5 | Upgraded to ES2023, added raycast-env.d.ts include, and enabled resolveJsonModule |
extensions/switchhosts/README.md |
4/5 | Added proper documentation with installation requirements and feature listing |
extensions/switchhosts/CHANGELOG.md |
4/5 | Added comprehensive changelog with proper formatting and {PR_MERGE_DATE} template |
extensions/switchhosts/.eslintrc.json |
5/5 | Removed deprecated ESLint configuration file as part of modernization |
Confidence score: 3/5
- This PR requires careful review due to potential state consistency issues in the optimistic update logic
- Score lowered due to a mismatch between optimistic update state and toast message logic that could confuse users
- Pay close attention to
extensions/switchhosts/src/switchhosts.tsxfor the state management implementation
7 files reviewed, 4 comments
| optimisticUpdate(data) { | ||
| return data.map((d) => (d.id === item.id ? { ...d, on: !d.on } : d)); | ||
| }, |
There was a problem hiding this comment.
logic: Potential issue: optimistic update toggles on state, but success message on line 90 uses original item.on value. This creates incorrect toast messages - when turning ON a host, it shows 'Close Host Success'.
commented
Aug 18, 2025
|
Published to the Raycast Store: |
commented
Aug 18, 2025
|
🎉 🎉 🎉 We've rewarded your Raycast account with some credits. You will soon be able to exchange them for some swag. |
Description
Iconbased on typeIcontoActionchore: update deps and scriptseslint.config.jsScreencast
switchosts.mp4
Checklist
npm run buildand tested this distribution build in Raycastassetsfolder are used by the extension itselfREADMEare located outside the metadata folder if they were not generated with our metadata tool