Skip to content

[BUG]: Fix Lack of Type Safety in Redux Selectors (Replace any with RootState) #2485

@priyabratasahoo780

Description

@priyabratasahoo780

Bug Description

Throughout the frontend application, the Redux useSelector hook is used without proper typings. The code currently uses useSelector((state: any) => state.something) in dozens of files across frontend/src/screens and frontend/src/components. This bypasses TypeScript entirely, making state access prone to runtime errors if the Redux state shape changes.

Steps to Reproduce

  1. Open any component or screen file in the codebase (e.g., frontend/src/screens/UserProfileScreen.tsx).
  2. Search for the useSelector hook.
  3. Observe that it is typed as useSelector((state: any) => ...) instead of utilizing the RootState defined in ReduxStore.ts.
  4. Run the TypeScript compiler (pnpm run type-check) and note that state access errors are not caught because of the any type.

Affected Area

Dashboard

Screenshots

No response

Browser & OS

Not applicable (Codebase architecture issue).

Environment

None

Additional Context

We should create a custom reduxHooks.ts file that exports a strongly typed useAppSelector and useAppDispatch to resolve this technical debt once and for all.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinggssoc:assignedGSSoC: Issue assigned to a contributorneeds-triageNeeds maintainer triage

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions