Skip to content

Use zustand instead of redux#319

Merged
bastiendmt merged 3 commits intomainfrom
feature/zustand
Mar 2, 2026
Merged

Use zustand instead of redux#319
bastiendmt merged 3 commits intomainfrom
feature/zustand

Conversation

@bastiendmt
Copy link
Copy Markdown
Owner

@bastiendmt bastiendmt requested a review from Copilot June 22, 2025 14:07
@bastiendmt bastiendmt self-assigned this Jun 22, 2025
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 useAppStore with 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 audioEml is unclear; consider renaming to audioRef or audioElem for clarity.
  const audioEml = useRef<ElementRef<'audio'>>(null);

src/pages/PlaylistDetail/SongItem/SongItem.tsx:14

  • [nitpick] The interface name SongItemPros seems like a typo; rename it to SongItemProps to follow the common Props suffix 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 NotFound component is rendered when error is set.
  test('should render error state when there is an error', async () => {

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@sonarqubecloud
Copy link
Copy Markdown

@bastiendmt bastiendmt merged commit 27f67ee into main Mar 2, 2026
13 checks passed
@bastiendmt bastiendmt deleted the feature/zustand branch March 13, 2026 23:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants