Configuration UI Flickering - cc-switch
Quick fix
Upgrade cc-switch to fix flickering from async form loading; read SQLite DB to fix env vars not updating with providers.
Symptom
Section titled “Symptom”配置界面闪烁Configuration UI flickering
When editing the currently active provider in cc-switch, the form initially mounts using database configuration, then asynchronously reads the real-time ~/.claude/settings.json and replaces it. This delayed replacement triggers form.reset, causing fields like API Key to reinitialize after the first screen render, resulting in UI flickering. Additionally, due to adjustments in the general configuration feature, custom environment variables configured per provider (e.g., env.CC_SWITCH_RELAY_NAME) no longer update automatically when switching providers.
Upgrade cc-switch to a version containing PR #4277. This update ensures the form mounts only once after real-time configuration is ready (showing a spinner during loading), eliminating flickering caused by asynchronous replacement.
To retrieve custom environment variables such as the current relay name, stop reading from settings.json and instead write a Bash wrapper script to query cc-switch's local SQLite database directly.
$HOME/.cc-switch/cc-switch.db #!/usr/bin/env bashset -euo pipefailpayload="$(cat)"DB="$HOME/.cc-switch/cc-switch.db"label=""if [[ -f "$DB" ]]; thenlabel="$(sqlite3 \-cmd ".timeout 200" \-noheader -batch "$DB" \"SELECT nameFROM providersWHERE app_type='claude' AND is_current=1LIMIT 1;" 2>/dev/null)" || label=""fi[[ -z "$label" ]] && label="Unknown"ccline_out="$(printf '%s' "$payload" | ccline 2>/dev/null | head -n1)"printf '⚡%s | %s\n' "$label" "$ccline_out"
Affected Versions
Section titled “Affected Versions”Source Issues
Section titled “Source Issues”This page is distilled from 2 real issues
- Why can't I find the 'Edit General Configuration' entry in the new version?
- The author reverted the general configuration feature. The current logic requires manually editing Claude's settings.json to add general configurations; these non-whitelisted fields will not be overwritten when switching providers.
- Will the UI flickering loop infinitely?
- No. It is a one-time bounded reinitialization that occurs when opening the edit dialog, most noticeable when manual edits to settings.json cause inconsistencies between real-time data and the database.
Related problems
Section titled “Related problems”This is an unofficial community wiki with no affiliation to the cc-switch authors or the project itself. Its content is compiled from the project's public GitHub issues. This site distributes no software.