@@ -7,6 +7,7 @@ import { findSkillsMatches, GroupedSkills, groupSkillsByCategory } from '../lib'
77import { SkillsBulkEditorContext , useSkillsBulkEditorContext } from './use-skills-bulk-editor-context'
88
99export interface SkillsManagerContextValue {
10+ allSkills : StandardizedSkill [ ] ,
1011 categories : StandardizedSkillCategory [ ]
1112 skillsFilter : string
1213 setSkillsFilter : ( filter : string ) => void
@@ -37,16 +38,20 @@ export const SkillsManagerContext: FC<SkillsManagerContextProps> = props => {
3738 const [ editSkill , setEditSkill ] = useState < StandardizedSkill > ( )
3839
3940 const {
40- data : allSkills ,
41+ data : allSkills = [ ] ,
4142 mutate : refetchSkills ,
42- } : SWRResponse < StandardizedSkill [ ] > = useFetchSkills ( showArchivedSkills )
43+ } : SWRResponse < StandardizedSkill [ ] > = useFetchSkills ( true )
4344
4445 const {
4546 data : allCategories = [ ] ,
4647 mutate : refetchCategories ,
4748 } : SWRResponse < StandardizedSkillCategory [ ] > = useFetchCategories ( )
4849
49- const skills = useMemo ( ( ) => findSkillsMatches ( allSkills ?? [ ] , skillsFilter ) , [ allSkills , skillsFilter ] )
50+ const filteredSkills = useMemo ( ( ) => (
51+ showArchivedSkills ? allSkills : allSkills . filter ( s => ! s . deleted_at )
52+ ) , [ allSkills , showArchivedSkills ] )
53+
54+ const skills = useMemo ( ( ) => findSkillsMatches ( filteredSkills , skillsFilter ) , [ filteredSkills , skillsFilter ] )
5055 const groupedSkills = useMemo ( ( ) => groupSkillsByCategory ( skills ) , [ skills ] )
5156
5257 const bulkEditorCtx = useSkillsBulkEditorContext ( skills )
@@ -56,6 +61,7 @@ export const SkillsManagerContext: FC<SkillsManagerContextProps> = props => {
5661 } , [ ] )
5762
5863 const contextValue = useMemo ( ( ) => ( {
64+ allSkills,
5965 bulkEditorCtx,
6066 categories : allCategories ,
6167 editCategory,
@@ -71,6 +77,7 @@ export const SkillsManagerContext: FC<SkillsManagerContextProps> = props => {
7177 skillsList : skills ,
7278 toggleArchivedSkills,
7379 } ) , [
80+ allSkills ,
7481 bulkEditorCtx ,
7582 allCategories ,
7683 editCategory ,
0 commit comments