Skip to content

fix/state management connection glitches - #129

Merged
matheusfillipe merged 2 commits into
fix/mobile-improvementsfrom
fix/state-management-connection-glitches
Jan 29, 2026
Merged

matheusfillipe merged 2 commits into
fix/mobile-improvementsfrom
fix/state-management-connection-glitches

Conversation

@matheusfillipe

@matheusfillipe matheusfillipe commented Jan 26, 2026 •

Copy link
Copy Markdown
Contributor
  • fix some state and connection glitches and debounce connections

Summary by CodeRabbit

Release Notes

  • New Features

    • Added mobile swipe-based navigation for seamless switching between server list, chat, and member views
    • Loading indicator now displays during server connection
    • Channel topic editing modal for easier topic management
    • Away message and quit message settings in user profile configuration
    • Enhanced search with clear button and improved visibility
  • Improvements

    • Profile settings redesigned for better usability and organization
    • Connection timeout handling enhanced for improved reliability
    • Better channel and private chat selection behavior

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai

coderabbitai Bot commented Jan 26, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • 🔍 Trigger a full review
📝 Walkthrough

Walkthrough

This PR introduces mobile swipe navigation, extends store APIs with away status and navigation options, implements a new localStorage persistence layer with migrations, adds new UI components (HeaderOverflowMenu, TopicModal, LoadingOverlay), refactors AppLayout for narrow view support, and enhances IRC client functionality with deterministic IDs, rate limiting, and away command support.

Changes

Cohort / File(s) Summary
Dependency Updates
biome.json, package.json
Updated @biomejs/biome schema and dependency from 2.2.4 to 2.3.12.
Mobile Navigation
src/hooks/useSwipeNavigation.ts, src/components/layout/AppLayout.tsx
New useSwipeNavigation hook enables touch-based horizontal pagination with direction locking and rubber-band effects. AppLayout refactored to render swipeable pages in narrow view (serverList → chatView → memberList) while desktop remains unchanged. Added PAGE_ORDER mapping and mobile page synchronization logic.
Layout Component Updates
src/components/layout/ChannelList.tsx, src/components/layout/ChatArea.tsx, src/components/layout/ChatHeader.tsx, src/components/layout/MemberList.tsx, src/components/layout/ResizableSidebar.tsx, src/components/layout/ServerList.tsx
Multiple layout components updated to support navigate options in channel/chat selection. ChatArea enhanced with IntersectionObserver-based scroll detection and mobile visibility awareness. ChatHeader adds search expansion, overflow menu, and TopicModal for narrow view. ServerList replaces options dropdown with dedicated Add Server button. ResizableSidebar improves transition styling.
New UI Components
src/components/ui/HeaderOverflowMenu.tsx, src/components/ui/TopicModal.tsx, src/components/ui/LoadingOverlay.tsx
HeaderOverflowMenu: portal-based dropdown with position clamping and keyboard navigation. TopicModal: channel topic editing modal with permission checks. LoadingOverlay: full-screen loading indicator with backdrop blur.
Selection & Navigation
src/components/ui/AddPrivateChatModal.tsx, src/components/ui/BlankPage.tsx, src/components/ui/QuickActions.tsx, src/components/ui/UserProfileModal.tsx
Updated selection calls to pass navigate options (e.g., selectChannel, selectPrivateChat) enabling programmatic navigation. BlankPage adds button to toggle ChannelListModal. UserProfileModal adds away status UI and toggles. QuickActions unified to use joinAndSelectChannel.
App & Store Integration
src/App.tsx
Added LoadingOverlay component conditional on isConnecting. Added TAURI environment guard in deep-link setup. Extended useStore contract to include isConnecting.
Channel Operations
src/hooks/useJoinAndSelectChannel.ts, src/components/ui/ChannelListModal.tsx
New useJoinAndSelectChannel hook polls store for newly joined channel then auto-selects with navigate flag. ChannelListModal replaced joinChannel with useJoinAndSelectChannel for unified join+select behavior.
Message & Command Handling
src/hooks/useMessageSending.ts, src/hooks/useReactions.ts
useMessageSending adds /away and /back IRC commands via new setAway/clearAway store actions. useReactions cleans up dependency arrays by removing unnecessary store setter.
IRC Client Core
src/lib/ircClient.ts
Added generateDeterministicId for consistent channel/chat IDs using uuidv5. Introduced per-server rate-limit tracking with exponential backoff and cooldown enforcement. Extended disconnect to accept quitMessage parameter. Added removeServer, setAway, clearAway convenience methods. Enhanced reconnection logic and WebSocket URL parsing (ws://wss:// support).
Connection Protocol
src/protocol/index.ts
Introduced per-server connection timeout (30s) to reset connecting state. Tracks connectionState transitions and manages timeout cleanup. Exports clearServerConnectionTimeout for external use.
Persistence Layer
src/store/localStorage.ts, src/store/migrations.ts, src/store/types.ts
New localStorage module centralizes browser storage with namespaced sections (servers, metadata, settings, channelOrder, pinnedChats, uiSelections). Migrations system with v1 migration adding addedAt timestamps to servers. New store types: SavedMetadata, PinnedPrivateChatsMap, ChannelOrderMap, GlobalSettings, UISelections.
Store State Management
src/store/index.ts
Extensive refactor: integrated localStorage/migrations at startup. Added generateDeterministicId helper. Introduced setAway, clearAway, setMobileView public actions. Extended select signatures with navigate/clearSelection options. Added isNewServer parameter to connect. Introduced isAddingNewServer state. Refactored mobile navigation with column synchronization. Added host normalization (normalizeHost, ensureUrlFormat).
Type System
src/types/index.ts, src/lib/modal/SearchableModal.tsx, src/lib/settings/definitions/allSettings.ts
Added addedAt field to ServerConfig. Updated SearchableModalProps with isOpen prop. Refactored profile settings: clarified descriptions, changed Bot from toggle to text input, added Away Message and Quit Message settings with subcategory Status Messages.
User Settings & Profile
src/components/ui/UserSettings.tsx
Removed isHostedChatMode gate. Introduced metadata-driven profile UI using settings registry. Added away/quit message state management. Refactored into Extended Profile section with dynamic fields driven by registry. Added Status Messages subsection.
Test Coverage
tests/App.test.tsx, tests/components/layout/AppLayout.test.tsx, tests/components/MetadataDisplay.test.tsx, tests/hooks/useSwipeNavigation.test.ts
Updated App tests for new Add Server button path. Comprehensive AppLayout test suite covering swipe navigation (mobile), desktop layouts, and Android back button behavior. Added AppLayout swipe utilities and assertions. New useSwipeNavigation tests covering threshold logic, direction locking, rubber-band effects, and transition states. Updated metadata test defaults with awayMessage and quitMessage.

Sequence Diagram

sequenceDiagram
    participant User as User
    participant AppLayout as AppLayout
    participant TouchState as Touch Handler
    participant SwipeNav as useSwipeNavigation
    participant Store as Store
    participant Render as Component Render

    User->>AppLayout: Touch screen (swipe)
    AppLayout->>TouchState: handleTouchStart
    TouchState->>SwipeNav: recordTouchStart position
    
    User->>AppLayout: Drag finger
    AppLayout->>TouchState: handleTouchMove (repeated)
    TouchState->>SwipeNav: calculateDrag offset & direction
    SwipeNav->>Render: Update offset via ref
    Render->>Render: Visual drag feedback
    
    User->>AppLayout: Release finger
    AppLayout->>TouchState: handleTouchEnd
    TouchState->>SwipeNav: Evaluate swipe magnitude vs threshold
    
    alt Swipe exceeds threshold
        SwipeNav->>SwipeNav: Calculate page change
        SwipeNav->>Store: Call onPageChange(newPage)
        Store->>Store: Update mobileViewActiveColumn
        SwipeNav->>Render: Trigger 300ms transition
        Render->>Render: Animate to new page position
    else Below threshold
        SwipeNav->>SwipeNav: Reset offset to 0
        Render->>Render: Snap back to current page
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested reviewers

  • ValwareIRC

Poem

🐰 A rabbit hops through swipes so neat,
Left, right, and back with touch so sweet,
Away I go, my status set,
Mobile views—the smoothest yet!
With localStorage to remember all,
ObsidianIRC answers the call. 🌙

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix/state management connection glitches' directly describes the main objective of this changeset, which focuses on fixing state management and connection-related issues across the application.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@matheusfillipe
matheusfillipe changed the base branch from main to fix/mobile-improvements January 26, 2026 18:35
@github-actions

Copy link
Copy Markdown

Pages Preview
Preview URL: https://fix-state-management-connect.obsidianirc.pages.dev

Automated deployment preview for the PR in the Cloudflare Pages.

@matheusfillipe
matheusfillipe merged commit 249c80e into fix/mobile-improvements Jan 29, 2026
4 checks passed
@matheusfillipe
matheusfillipe deleted the fix/state-management-connection-glitches branch January 29, 2026 09:39
matheusfillipe added a commit that referenced this pull request Jan 29, 2026
* minor state fixes and ensure entering channel from channel list modal

* Simplify add server button

* improve header for mobile

* hmmm dark background is better honestly

* add server channels button to blank server page

* Use loading spinner for server connection

* swipe left and right for mobile pages

* fix typescript build errors

* 08:49 < user379> the three-dots menu when on a narrow screen doesn't open any menu

* 08:49 < user379> "Account settings are only available in hosted chat mode."

08:49 < user379> what
08:49 < Valware> why though
08:49 < Valware> =]

* 08:49 < Valware> also none of the ircs:// are able to be reconnected to when I close and reopen the app

* avoid auto entering channels on mobile width

* small fix for menus

* many fixes

* update biome

* fix state messup when resizing

* fix sidebars shadow effect

* Fix scroll detection

* Fix state handling on app opening

* keep server order

* Fix drag in member list

* fix: Realname is not metadata

* bring away and quit messages back

* add away and back commands

* refactor

* fix/state management connection glitches (#129)

* fix some state and connection glitches and debounce connections

* make + smaller

* Fix sidebar/pages states on resize and add more coverage

* fix scroll

* prevent overshooting swipe
@coderabbitai coderabbitai Bot mentioned this pull request Feb 12, 2026
8 tasks done
zocram4cc pushed a commit to zocram4cc/ObsidianIRC that referenced this pull request Feb 17, 2026
* minor state fixes and ensure entering channel from channel list modal

* Simplify add server button

* improve header for mobile

* hmmm dark background is better honestly

* add server channels button to blank server page

* Use loading spinner for server connection

* swipe left and right for mobile pages

* fix typescript build errors

* 08:49 < user379> the three-dots menu when on a narrow screen doesn't open any menu

* 08:49 < user379> "Account settings are only available in hosted chat mode."

08:49 < user379> what
08:49 < Valware> why though
08:49 < Valware> =]

* 08:49 < Valware> also none of the ircs:// are able to be reconnected to when I close and reopen the app

* avoid auto entering channels on mobile width

* small fix for menus

* many fixes

* update biome

* fix state messup when resizing

* fix sidebars shadow effect

* Fix scroll detection

* Fix state handling on app opening

* keep server order

* Fix drag in member list

* fix: Realname is not metadata

* bring away and quit messages back

* add away and back commands

* refactor

* fix/state management connection glitches (obbyworld#129)

* fix some state and connection glitches and debounce connections

* make + smaller

* Fix sidebar/pages states on resize and add more coverage

* fix scroll

* prevent overshooting swipe
@coderabbitai coderabbitai Bot mentioned this pull request Mar 12, 2026
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