Fix Bluetooth & Spotify Improvements (PR #9662) - #9663
Conversation
- Refactored `SpotifyControls.tsx` to remove verbose optimistic UI comments and rely entirely on the timeout for state normalization. - Refactored `hooks/usePersistentStorage.ts` to use `lodash/isEqual` instead of `JSON.stringify` for deep equality comparison to avoid performance penalties. - Centralized numeric type conversions in `context/UserSettingsContext.tsx` via mapping array instead of manual checks. - Replaced the hardcoded `20000` ms GATT connection timeout fallback with the `DATA_LIVENESS_TIMEOUT_MS` constant in `useBluetoothHRM.ts` and restored `lastWatchdogMark` reset behavior to prevent unit test regressions. Co-authored-by: arii <342438+arii@users.noreply.github.com>
|
👋 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 New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
🤖 AI Technical AuditPR Review: Bluetooth & Spotify ImprovementsArchitectural ImpactThis PR introduces optimistic UI updates to the Spotify integration and shifts the storage strategy from synchronous initialization to an effect-based hydration model. While the optimistic UI improves perceived performance, the changes in File-by-File Analysis
|
Acknowledged. |
- Refactored `SpotifyControls.tsx` to remove verbose optimistic UI comments and rely entirely on the timeout for state normalization. - Refactored `hooks/usePersistentStorage.ts` to use `lodash/isEqual` instead of `JSON.stringify` for deep equality comparison to avoid performance penalties. - Centralized numeric type conversions in `context/UserSettingsContext.tsx` via mapping array instead of manual checks. - Replaced the hardcoded `20000` ms GATT connection timeout fallback with the `DATA_LIVENESS_TIMEOUT_MS` constant in `useBluetoothHRM.ts` and restored `lastWatchdogMark` reset behavior to prevent unit test regressions. Co-authored-by: arii <342438+arii@users.noreply.github.com>
🤖 Gemini Review SkippedReview was skipped for the following reason: 🤖 Gemini Manual Trigger Guide |
- Installed `lodash` and `@types/lodash` since `lodash/isEqual` was being used in hooks and context but the package was missing from package.json. This fixes the CI failure caused by the missing module. Co-authored-by: arii <342438+arii@users.noreply.github.com>
🤖 Gemini Review SkippedReview was skipped for the following reason: 🤖 Gemini Manual Trigger Guide |
Repairs PR #9662 by incorporating the fixes requested by the principal engineer.
app/client/control/components/SpotifyControls.tsx: The explicit clear ofoptimisticIsPlayinginside theuseEffectwas removed to rely solely on the 2.5s timer (playbackGraceTimerRef), reducing flicker and preventing race conditions, and unneeded comments were deleted.hooks/usePersistentStorage.ts: Swapped out the expensiveJSON.stringifychecks forisEqualfrom lodash, improving the performance on every render.context/UserSettingsContext.tsx: Simplified themigratePreferencesfunction to map over a list ofnumericFieldsdirectly, removing the redundant single-field parses. Also replacedJSON.stringifywithisEqual.hooks/useBluetoothHRM.ts: Ensured no hidden string default timeouts or fallback literals by substituting the hardcoded20000timeout parameter insidecancellablePromisewith the canonicalDATA_LIVENESS_TIMEOUT_MS. RestoredlastWatchdogMark.current = 0to preserve expected watchdog tracking behavior in unit tests.PR created automatically by Jules for task 12597848218781664933 started by @arii