AOSSIE-Org / AOSSIE-Org/PictoPy

Issues in `src/features` folder (Parent ID comparisons, onboarding loop timeouts, and type safety)

Aberta
#1,379 6 comentários 0 reações 0 responsáveis Ver no GitHub
Linguagem predominante
Python
Estrelas
283
Forks
679
Merge médio
7d 2h
PRs com merge (30d)
3

Descrição

# Bug Report: Issues in `src/features` folder (Parent ID comparisons, onboarding loop timeouts, and type safety)

## Description
A series of bugs and technical debt items were identified in the Redux slices and selectors inside `frontend/src/features`. These issues caused strict comparison bugs (e.g. failing to render/resolve root folders in hierarchy selectors), cascading state updates during initialization leading to Jest timeouts/warnings, and type inconsistency.

---

## Identified Issues & Impact

### 1. Root Folders Ignored due to Parent ID Mismatch (`folderSelectors.ts`)
* **Bug**: The selectors `selectFoldersByParentId` and `selectFolderHierarchy` strictly compared parent IDs: `folder.parent_folder_id === parentId`.
* **Details**: In `FolderDetails`, `parent_folder_id` is an optional string (`string | undefined`), while root queries pass `parentId: string | null`. Under strict equality, `undefined === null` evaluates to `false`.
* **Impact**: Hierarchy generation (`selectFolderHierarchy`) and filtering root folders via `selectFoldersByParentId(state, null)` failed entirely (returned empty arrays).

### 2. Cascading Re-renders & Test Timeouts (`onboardingSlice.ts`)
* **Bug**: The onboarding state initialized all step statuses to `false` regardless of existing local storage. Each step component mounted, read its completion from `localStorage`, and then dispatched `markCompleted` in a `useEffect` on mount.
* **Impact**: On initial app load/mounting, components repeatedly dispatched state updates in a chain, causing React state update console warnings (`not wrapped in act(...)`) and causing Jest tests to exceed the default 5000ms timeout.

### 3. Type Inconsistency in Memories Selector (`memoriesSlice.ts`)
* **Bug**: The `selectSelectedMemory` selector was typed with a local state shape `(state: { memories: MemoriesState })` instead of the standard `RootState` used by all other selectors in the project.

### 4. Dead Code (`folderThunks.ts`)
* **Issue**: An empty `folderThunks.ts` (0 bytes) existed in the directory but was never used or imported.

---

Guia de contribuição

Abrir o guia de contribuição

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.