[PR #97] [MERGED] Prevent incessant rerenders while playing #118

Closed
opened 2026-02-28 15:42:14 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/usenocturne/nocturne-ui/pull/97
Author: @alvvaro
Created: 4/23/2025
Status: Merged
Merged: 4/23/2025
Merged by: @brandonsaldan

Base: mainHead: alvvaro/fix-playbackcontext-rerendering


📝 Commits (2)

  • f1dfb55 remove PlaybackProgressContext
  • 7956e3e remove unused usePlaybackProgress import

📊 Changes

5 files changed (+94 additions, -120 deletions)

View changed files

📝 src/App.jsx (+86 -90)
📝 src/components/player/NowPlaying.jsx (+1 -0)
📝 src/components/player/ProgressBar.jsx (+6 -14)
📝 src/hooks/usePlaybackProgress.js (+1 -13)
📝 src/hooks/useSpotifyData.js (+0 -3)

📄 Description

This PR removes the top level PlaybackProgressContext and unsubscribes useSpotifyData from usePlaybackProgress, as both things were causing the whole App component to rerender many times per second while music was playing.

The Context provided no value, since there was a circular dependency between it and the usePlaybackProgress hook.

Components that need playback information (e.g. NowPlaying) should explicitely suscribe to the progress hook.

PS: Best to look at the PR diff with whitespaces changes OFF

Before:
Screen Recording 2025-04-23 at 19 02 36

After:
Screen Recording 2025-04-23 at 19 03 39


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/usenocturne/nocturne-ui/pull/97 **Author:** [@alvvaro](https://github.com/alvvaro) **Created:** 4/23/2025 **Status:** ✅ Merged **Merged:** 4/23/2025 **Merged by:** [@brandonsaldan](https://github.com/brandonsaldan) **Base:** `main` ← **Head:** `alvvaro/fix-playbackcontext-rerendering` --- ### 📝 Commits (2) - [`f1dfb55`](https://github.com/usenocturne/nocturne-ui/commit/f1dfb5577091f5eed064af5cae1ce3d44fb3ff6b) remove PlaybackProgressContext - [`7956e3e`](https://github.com/usenocturne/nocturne-ui/commit/7956e3e2c31369b35234f4899869a6e116547d15) remove unused usePlaybackProgress import ### 📊 Changes **5 files changed** (+94 additions, -120 deletions) <details> <summary>View changed files</summary> 📝 `src/App.jsx` (+86 -90) 📝 `src/components/player/NowPlaying.jsx` (+1 -0) 📝 `src/components/player/ProgressBar.jsx` (+6 -14) 📝 `src/hooks/usePlaybackProgress.js` (+1 -13) 📝 `src/hooks/useSpotifyData.js` (+0 -3) </details> ### 📄 Description This PR removes the top level `PlaybackProgressContext` and unsubscribes `useSpotifyData` from `usePlaybackProgress`, as both things were causing the whole App component to rerender many times per second while music was playing. The Context provided no value, since there was a circular dependency between it and the `usePlaybackProgress` hook. Components that need playback information (e.g. `NowPlaying`) should explicitely suscribe to the progress hook. PS: Best to look at the PR diff with whitespaces changes OFF Before: ![Screen Recording 2025-04-23 at 19 02 36](https://github.com/user-attachments/assets/2d01d41c-858d-4515-b4e2-2cfaf987535c) After: ![Screen Recording 2025-04-23 at 19 03 39](https://github.com/user-attachments/assets/f10d35aa-5a2c-4355-ada4-8f9219c4d0e0) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-28 15:42:14 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/nocturne-ui#118
No description provided.