Skip to content

🧹 Remove dead code and unused methods in apiClient.ts#36

Merged
0suu merged 2 commits into
mainfrom
cleanup-apiclient-dead-code-8271089394660376814
Feb 13, 2026
Merged

🧹 Remove dead code and unused methods in apiClient.ts#36
0suu merged 2 commits into
mainfrom
cleanup-apiclient-dead-code-8271089394660376814

Conversation

@0suu

@0suu 0suu commented Feb 7, 2026

Copy link
Copy Markdown
Owner

This PR addresses a code health issue in src/api/apiClient.ts by removing dead code and unused methods.

🎯 What:

  • Removed commented-out imports for axios and crypto-js.
  • Removed the commented-out API_BASE_URL constant.
  • Removed the unused handleApiError method.
  • Removed unnecessary comments in the constructor.

💡 Why:

  • These imports and methods were no longer used as the application now uses an IPC bridge to communicate with the main process, which handles the actual API calls using axios.
  • Removing dead code improves maintainability and readability by reducing clutter and confusion.

Verification:

  • Verified that the SwitchBotAPI class can still be instantiated and used.
  • Ran npm run build:vite and npm test to ensure no build errors or test regressions.
  • Created a temporary test file src/api/__tests__/apiClient.test.ts to confirm the class works as expected, then removed it.

Result:

  • Cleaner src/api/apiClient.ts file without unnecessary commented-out code or unused methods.

PR created automatically by Jules for task 8271089394660376814 started by @0suu

- Removed commented-out imports (`axios`, `crypto-js`)
- Removed commented-out `API_BASE_URL` constant
- Removed unused `handleApiError` method
- Cleaned up comments in `SwitchBotAPI` constructor

Co-authored-by: 0suu <46421931+0suu@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello @0suu, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on improving code health and maintainability by systematically removing obsolete and unused code within the src/api/apiClient.ts file. The changes reflect an architectural shift where API calls are now handled via an IPC bridge, rendering direct axios usage and related error handling mechanisms redundant. The primary impact is a cleaner, more readable codebase with reduced clutter, making it easier to understand and maintain.

Highlights

  • Dead Code Removal: Removed commented-out imports for axios and crypto-js, as well as the commented-out API_BASE_URL constant, which were no longer in use.
  • Unused Method Elimination: The handleApiError method, which was no longer needed due to changes in API error handling, has been removed.
  • Code Cleanup: Unnecessary comments within the constructor of the SwitchBotAPI class have been removed to improve readability.
  • Type Definition Refinement: The AnyDevice type import was removed from src/api/apiClient.ts as it was not being utilized.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • src/api/apiClient.ts
    • Removed commented-out imports for axios, crypto-js, and the AnyDevice type.
    • Deleted the commented-out API_BASE_URL constant.
    • Removed an unnecessary comment from the constructor method.
    • Eliminated the unused handleApiError private method.
Activity
  • The author verified that the SwitchBotAPI class remains functional after the changes.
  • Builds (npm run build:vite) and tests (npm test) were run to confirm no regressions or errors were introduced.
  • A temporary test file (src/api/__tests__/apiClient.test.ts) was created and used to confirm class functionality before being removed.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Feb 7, 2026

Copy link
Copy Markdown

Deploying switchbotcontroller with  Cloudflare Pages  Cloudflare Pages

Latest commit: ab57c7f
Status: ✅  Deploy successful!
Preview URL: https://8b3a77b2.switchbotcontroller.pages.dev
Branch Preview URL: https://cleanup-apiclient-dead-code.switchbotcontroller.pages.dev

View logs

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request does a great job of cleaning up apiClient.ts by removing dead code and unused methods. My review includes one suggestion to further simplify the code by removing the now-empty constructor, which aligns with the goal of this PR.

Comment thread src/api/apiClient.ts
Comment on lines 48 to 51
constructor() {
// No need to initialize axios client or interceptors
// We'll use the IPC bridge to communicate with the main process
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Since the constructor is now effectively empty, it can be removed entirely along with the extra newline. TypeScript will provide a default public constructor automatically. This further cleans up the class.

@0suu

0suu commented Feb 13, 2026

Copy link
Copy Markdown
Owner Author

@codex review

Co-authored-by: 0suu <46421931+0suu@users.noreply.github.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@0suu
0suu merged commit 84786b5 into main Feb 13, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant