-
Notifications
You must be signed in to change notification settings - Fork 0
fix double join call #65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
For some UIs, it is not necessary to reload the application when the room combination state changes. In addition, the application may also be able to update itself without restarting as well, by requesting the correct room key from Essentials. The handler for the `/system/roomCombinationChanged` now checks for any registered handlers. If no handlers are found, then the application is reloaded, which is the existing behavior. If handlers are found, then the handlers are executed, and the default behavior is not. This allows for customizing what happens when the room combination state changes, while keeping the existing behavior in place for backwards compatibility.
…export-useCameraBase
…export-useCameraBase
… for better performance
…ction for clearing state
This value being a dependency of the join websocket effect was causing a double call to the joinRoom endpoint.
Removing that dependency prevented auto-connection from happening
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Refactors WebSocket handling into Redux middleware to prevent duplicate join calls, reorganizes and expands type/interface exports, and updates UI event handling and initialization logic for improved consistency and maintainability.
- Introduces Redux WebSocket middleware with action-based API and removes previous in-component connection logic.
- Adjusts numerous type interfaces (adds fields, makes fields optional, removes exports) and expands barrel exports.
- Adds sync state tracking hook and UI state, switches UI event handlers to onPointerDown, and refactors initialization hook location.
Reviewed Changes
Copilot reviewed 51 out of 52 changed files in this pull request and generated 21 comments.
Show a summary per file
| File | Description |
|---|---|
| vite.config.ts | Adds cssFileName and formatting updates to support new style export mapping. |
| src/lib/utils/useWebsocketContext.ts | Switches to named import of WebsocketContext (potential API break). |
| src/lib/utils/index.ts | Adds WebsocketContext to barrel exports. |
| src/lib/utils/WebsocketProvider.tsx | Refactors provider to delegate all WebSocket operations to Redux middleware. |
| src/lib/utils/WebsocketContext.ts | Converts default export to named export, expanding interface formatting. |
| src/lib/types/state/... | Widespread interface changes (added/removed fields, optionality shifts, new types, documentation). |
| src/lib/store/**/* | Adds WebSocket middleware, sync state tracking in UI slice, new selectors/hooks, and middleware wiring. |
| src/lib/shared/hooks/** | Adds new hooks (useStateIsSynced, camera-related) and updates interface hook exports. |
| src/lib/shared/disconnectedMessage/DisconnectedMessage.tsx | Uses onPointerDown for interaction consistency. |
| src/lib/shared/Icons/IconLibrary.tsx | Uses onPointerDown and formatting improvements. |
| src/lib/services/** | Moves initialization logic to new useInitialize hook file. |
| package.json | Adjusts style.css export map and repository URL. |
| WEBSOCKET_REFACTOR_SUMMARY.md | Adds documentation for WebSocket refactor. |
| AUTOMATIC_ROOM_STATUS_IMPLEMENTATION.md | Documents automatic status request approach. |
|
🎉 This PR is included in version 1.21.0-fix-double-join-call.6 🎉 The release is available on: Your semantic-release bot 📦🚀 |
|
🎉 This PR is included in version 1.21.0-fix-double-join-call.7 🎉 The release is available on: Your semantic-release bot 📦🚀 |
|
🎉 This PR is included in version 1.21.0-fix-double-join-call.8 🎉 The release is available on: Your semantic-release bot 📦🚀 |
|
🎉 This PR is included in version 1.21.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This pull request introduces several improvements and refactors across the codebase, with a focus on WebSocket middleware architecture, API initialization, and UI consistency. The most significant changes include a comprehensive WebSocket middleware refactor (with detailed documentation), a refactor of the API initialization hook, and various UI and interface consistency updates.
WebSocket Middleware Refactor and Documentation:
WEBSOCKET_REFACTOR_SUMMARY.mdandAUTOMATIC_ROOM_STATUS_IMPLEMENTATION.md) explains the rationale, implementation, and migration steps. [1] [2]API Initialization Refactor:
useInitializehook to its own file (useInitialize.ts), improved type safety, and updated the export path. The previous implementation inapiService.tswas removed. This change clarifies the initialization process and aligns with better code organization practices. [1] [2] [3]UI and Accessibility Improvements:
onPointerDowninstead ofonClickfor better cross-device interaction inIconLibraryandDisconnectedMessage. Also improved formatting and consistency in theIconLibrarycomponent. [1] [2] [3]Interface and Hook Exports Consistency:
src/lib/shared/hooks/interfaces/index.ts, adding missing hooks and ensuring all relevant interfaces are available for import. Added export foruseStateIsSyncedin the main hooks index. [1] [2]Package Metadata and Distribution:
style.cssexport inpackage.jsonto support both import and require syntaxes, and updated the repository URL for better compatibility with npm tooling. [1] [2]WebSocket Middleware and Documentation
WEBSOCKET_REFACTOR_SUMMARY.mdandAUTOMATIC_ROOM_STATUS_IMPLEMENTATION.mdto document the new Redux middleware approach, automatic room status requests, and migration steps. [1] [2]API Initialization Refactor
useInitializehook touseInitialize.ts, removed the old version fromapiService.ts, and updated exports for cleaner code and better type safety. [1] [2] [3]UI Consistency and Accessibility
onPointerDowninIconLibraryandDisconnectedMessagefor better device compatibility, and improved code formatting inIconLibrary. [1] [2] [3]Interface and Hook Exports
src/lib/shared/hooks/interfaces/index.ts, adding missing hooks and ensuring consistency. Updated main hooks index to exportuseStateIsSynced. [1] [2]Package Configuration
Fixed
style.cssexport to support both import and require, and updated the repository URL inpackage.jsonfor npm compatibility. [1] [2]ci: publish new build on non-main branch
fix: /system/roomCombinationChanged handling override
fix: and useCameraBase to exports
fix: update cameraList type to CameraState[]
feat: add useIHasCameras hook and IHasCamerasState interface
fix: extend IHasSelectableItemsState interface to inherit from DeviceState
feat: add usb support & currentSources interface
fix: add currentSources/keys to DisplayState
fix: make currentSource{s} optional
fix: export actions for use with storybook
chore(force-patch): fix casing issues
chore(force-patch): update tsconfig.json
fix: export websocket context
fix: change export style for WebsocketContext
fix: use correct import in hook
feat: adds SecondaryAudio to SignalType
fix: put back missing type exports
fix: use correct types and message format for DSP Preset recall
chore(force-patch): go back to default style.css name
fix: update css file name and exports
fix: remove extra .css
build: use correct URL for git repo
fix: make styles export an object
fix: update InputSlot and OutputSlot interfaces for better type safety
fix: remove unnecessary import from IHasSelectableItemsState
fix: comment out deprecated state property in DeviceState interface
fix: add deviceInterfaceSupport to RoomData interface and initial state
fix: add selectDeviceInterfaceSupport selector and corresponding hook
feat: implement useStateIsSynced hook and related UI state management
fix: add missing export for useStateIsSynced hook in index.ts
fix: update syncState to use array instead of Set for consistency in state management
fix: standardize import quotes and replace onClick with onPointerDown for better performance
fix: clear all modals and sync state on websocket disconnection
fix: refactor websocket disconnection handling to use a dedicated function for clearing state
fix: remove dependency on serverIsRunningOnProcessorHardware
chore(force-patch): disable exhaustive deps
fix: remove dependency for getRoomData callback
fix: add dep on serverIsRunningOnProcessorHardware back in
fix: move check for websocket before getRoomData call
feat: websocket is now middleware instead of react component
docs: Copilot refactoring documentation