AOSSIE-Org / AOSSIE-Org/PictoPy

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

Abierto
#1,379 6 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Python
Estrellas
283
Forks
679
Merge medio
7 d 2 h
PR fusionados (30 d)
3

Descripción

# 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.

---

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.