From eec48064f9a730a714020409fbbdc2eddfe64eae Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 28 Apr 2026 10:34:21 +0000 Subject: [PATCH] refactor(web): rename ServerState/ChatState/VoiceState -> *Signals (#261) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit web crate had three types that name-clash with authoritative willow_state and willow_client types: - web::state::ServerState vs willow_state::ServerState - web::state::ChatState vs willow_client::state::ChatState - web::state::VoiceState vs willow_client::state_actors::VoiceState spec say willow_state::ServerState is THE single source of truth. web sidecar holding Leptos signals shouldnt steal the name. rename web sidecar types to *Signals suffix. signals is what they hold (ReadSignal<...> fields), so name now describe content not fight upstream. mechanical find-replace, no surrounding refactor. callsites: 10 rename touches in 2 files (state.rs + call_page.rs comment). browser tests had no references. authoritative ServerState comments in settings.rs/holder_pill.rs/channel_sidebar.rs left alone — they correctly point at willow_state::ServerState fields (mute_state, channel_keys). verification: - cargo check -p willow-web --target wasm32-unknown-unknown: green - cargo check -p willow-web --tests --target wasm32-unknown-unknown: green - cargo fmt --check: clean - cargo clippy --workspace --all-targets -- -D warnings: zero warnings - cargo test --workspace: all green runner-up: ServerViewSignals/etc — rejected, unnecessarily verbose when *Signals already disambiguates from authoritative *State. Refs #261 --- crates/web/src/components/call_page.rs | 2 +- crates/web/src/state.rs | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/crates/web/src/components/call_page.rs b/crates/web/src/components/call_page.rs index e0d882eb..cef0c658 100644 --- a/crates/web/src/components/call_page.rs +++ b/crates/web/src/components/call_page.rs @@ -167,7 +167,7 @@ pub fn CallPage( let handle = use_context::().unwrap(); let vm = use_context::().unwrap(); - // Local video stream — stored globally in VoiceState so it survives remounts. + // Local video stream — stored globally in VoiceSignals so it survives remounts. let local_video_stream = app_state.voice.local_video_stream; // Duration timer — increments every second. Clean up on unmount so diff --git a/crates/web/src/state.rs b/crates/web/src/state.rs index e1d55e85..e5066925 100644 --- a/crates/web/src/state.rs +++ b/crates/web/src/state.rs @@ -81,11 +81,11 @@ pub struct ParsedJoinToken { #[derive(Clone, Copy)] pub struct AppState { - pub chat: ChatState, + pub chat: ChatSignals, pub network: NetworkState, - pub server: ServerState, + pub server: ServerSignals, pub ui: UiState, - pub voice: VoiceState, + pub voice: VoiceSignals, pub trust: TrustState, pub presence: PresenceUiState, /// Local-search UI state (phase 2e — `local-search.md`). @@ -224,7 +224,7 @@ pub struct TrustState { } #[derive(Clone, Copy)] -pub struct ChatState { +pub struct ChatSignals { pub messages: ReadSignal>, pub current_channel: ReadSignal, pub channels: ReadSignal>, @@ -249,7 +249,7 @@ pub struct NetworkState { } #[derive(Clone, Copy)] -pub struct ServerState { +pub struct ServerSignals { pub servers: ReadSignal>, pub active_server_id: ReadSignal, pub active_server_name: ReadSignal, @@ -288,7 +288,7 @@ pub struct UiState { } #[derive(Clone, Copy)] -pub struct VoiceState { +pub struct VoiceSignals { pub voice_channel: ReadSignal>, pub voice_muted: ReadSignal, pub voice_deafened: ReadSignal, @@ -590,7 +590,7 @@ pub fn create_signals() -> InitialSignals { let (profile_open, set_profile_open) = signal(Option::::None); let app_state = AppState { - chat: ChatState { + chat: ChatSignals { messages, current_channel, channels, @@ -608,7 +608,7 @@ pub fn create_signals() -> InitialSignals { connection_state, loading, }, - server: ServerState { + server: ServerSignals { servers, active_server_id, active_server_name, @@ -635,7 +635,7 @@ pub fn create_signals() -> InitialSignals { join_token, join_status, }, - voice: VoiceState { + voice: VoiceSignals { voice_channel, voice_muted, voice_deafened,