-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Persist Queue State Across Sessions #1601
base: master
Are you sure you want to change the base?
Conversation
Lines 22-25 in
|
Thanks for contributing, that's a pretty simple and robust solution to the problem. Could you please write a test to document that change? |
Also the description of the PR is quite obviously generated by some AI, some of the text is baffling and either completely untrue, or tautological. |
Sure!, I'll add the corresponding tests. Btw, I apologize for the description generated by the AI, I was lazy to disable the extension that makes the description and now that I see it, it has described many things that are wrong as you said. |
f59e30e
to
7627c08
Compare
7627c08
to
b5868c8
Compare
Hey, I have added an unit test, I have been trying different things to do it, as I know there are already several utilities for testing, but I have not found something specific to specifically test the changes I have made. I don't know if you are ok with the test I have added, if not, can you please give me some guidance on the best way to do it? |
Background
This PR addresses the issue#1434 where the music queue history was lost upon reopening the application. Previously, users would lose their current queue and the last played song every time they restarted the app, similar to a session reset.
Changes
Queue Persistence: The application now saves the state of the music queue (
queueItems
) and the index of the last played song (currentSong
) to local storage. This ensures that the user can resume exactly where they left off, even after closing and reopening the app.Automatic Resumption: Upon reopening the app, the queue is automatically restored along with the last played position. This feature mimics the behavior of popular music streaming services like Spotify, enhancing user experience by providing a seamless listening experience.
Manual Queue Reset: If the user decides to change the queue or select a different playlist, the application will reset the queue history as expected, allowing for intentional navigation away from the current playback context.
Implementation Details
electron-store
, taking advantage of its straightforward API and reliability.syncStorage
middleware to ensure that changes toqueueItems
andcurrentSong
are captured and persisted immediately to local storage.Testing
This update aims to improve usability by preserving user selections and reducing the friction of needing to reconfigure their music queue after a restart.