Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR replaces the existing Redux-based state management with a Zustand store, updating store setup, hooks, components, and tests accordingly.
- Introduces a central
useAppStorewith initial state and async actions via Zustand - Removes Redux slices, store configuration, and related hooks
- Updates components (
App,Player,PlaylistDetail,SongItem) and their tests to use Zustand and a new test-utils factory
Reviewed Changes
Copilot reviewed 16 out of 17 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/store/zustand-store.ts | Adds Zustand store, interfaces, state, and actions |
| src/store/test-utils.ts | Adds factory and mock setup for testing Zustand store |
| src/store/store.ts | Removes Redux store configuration |
| src/pages/PlaylistDetail/SongItem/SongItem.tsx | Switches SongItem to use Zustand hook |
| src/pages/PlaylistDetail/PlaylistDetail.tsx | Updates PlaylistDetail to fetch via Zustand |
| src/pages/PlaylistDetail/PlaylistDetail.spec.tsx | Migrates tests to mock Zustand store |
| src/components/Player/Player.tsx | Updates Player component to use Zustand actions |
| src/components/Player/Player.spec.tsx | Adjusts Player tests for Zustand |
| src/App.tsx | Replaces Redux hooks with Zustand equivalents |
| package.json | Removes Redux dependencies, adds Zustand |
Comments suppressed due to low confidence (3)
src/components/Player/Player.tsx:16
- [nitpick] The variable name
audioEmlis unclear; consider renaming toaudioReforaudioElemfor clarity.
const audioEml = useRef<ElementRef<'audio'>>(null);
src/pages/PlaylistDetail/SongItem/SongItem.tsx:14
- [nitpick] The interface name
SongItemProsseems like a typo; rename it toSongItemPropsto follow the commonPropssuffix convention.
const SongItem = ({ song, index, current }: SongItemPros) => {
src/pages/PlaylistDetail/PlaylistDetail.spec.tsx:60
- This test only asserts that the loader is gone; consider adding an assertion that the error message or
NotFoundcomponent is rendered whenerroris set.
test('should render error state when there is an error', async () => {
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



#281