AOSSIE-Org / AOSSIE-Org/PictoPy
Issues in `src/features` folder (Parent ID comparisons, onboarding loop timeouts, and type safety)
- 主要语言
- Python
- 星标
- 283
- 派生
- 679
- 平均合并
- 7 天 2 小时
- 30 天内合并 PR
- 3
描述
# 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.
---
贡献指南
评估
这个 Issue 还没有评估数据。