Summary
The useFilterState hook returns a tuple or object with various filter state values and functions, but the return type may not be fully typed, reducing IDE support and type safety.
Current State
- File:
control-plane/web/client/src/hooks/useFilterState.ts
- Issue: Return type may use inferred types or
any
Tasks
- Define explicit interface for hook return value
- Type all state values and setter functions
- Export types for consumer components to use
Example Implementation
// Define the return type interface
export interface FilterState {
filters: FilterTag[];
setFilters: React.Dispatch<React.SetStateAction<FilterTag[]>>;
addFilter: (filter: FilterTag) => void;
removeFilter: (filterId: string) => void;
clearFilters: () => void;
hasActiveFilters: boolean;
}
// Apply to hook
export function useFilterState(initialFilters?: FilterTag[]): FilterState {
// ... implementation
return {
filters,
setFilters,
addFilter,
removeFilter,
clearFilters,
hasActiveFilters,
};
}
Acceptance Criteria
Files
control-plane/web/client/src/hooks/useFilterState.ts
Using AI to solve this issue? Read our AI-Assisted Contributions guide for testing requirements, prompt strategies, and common pitfalls to avoid.
Summary
The
useFilterStatehook returns a tuple or object with various filter state values and functions, but the return type may not be fully typed, reducing IDE support and type safety.Current State
control-plane/web/client/src/hooks/useFilterState.tsanyTasks
Example Implementation
Acceptance Criteria
npm run lint)Files
control-plane/web/client/src/hooks/useFilterState.ts