@@ -2,6 +2,7 @@ import React, { useEffect, useState } from "react";
2
2
import styles from "./debugger-picker.module.scss" ;
3
3
import Select , { SingleValue } from "react-select" ;
4
4
import { DebuggerPickerOptionModel } from "@/features/common/models/debugger-picker-option.model" ;
5
+ import { LibraryFilterLabel } from "@/features/libraries/models/library-filters.model" ;
5
6
6
7
interface PickerLabelProps {
7
8
label : string | null ;
@@ -19,8 +20,8 @@ interface DebuggerPickerComponentProps {
19
20
label : string | null ;
20
21
languageCode : string ;
21
22
options : DebuggerPickerOptionModel [ ] ;
22
- selectedOptionCode : DebuggerPickerOptionModel | null ;
23
- handleSelection : ( value : string ) => void ;
23
+ selectedOptionCode : DebuggerPickerOptionModel [ "options" ] [ 0 ] | null ;
24
+ handleSelection : ( selection : string , parentLabel ?: LibraryFilterLabel ) => void
24
25
placeholder : string | null ;
25
26
minWidth : string | null ;
26
27
}
@@ -37,12 +38,14 @@ export const DebuggerPickerComponent: React.FC<
37
38
} ) => {
38
39
const [ isClient , setIsClient ] = useState ( false ) ;
39
40
40
- const handleChange = ( selection : SingleValue < DebuggerPickerOptionModel > ) => {
41
+ const handleChange = (
42
+ selection : SingleValue < DebuggerPickerOptionModel [ "options" ] [ 0 ] >
43
+ ) => {
41
44
if ( ! selection ) {
42
45
return ;
43
46
}
44
-
45
- handleSelection ( selection . value ) ;
47
+ const parentLabel = options . find ( group => group . options . some ( opt => opt . value === selection . value ) ) ?. label
48
+ handleSelection ( selection . value , parentLabel ) ;
46
49
} ;
47
50
48
51
useEffect ( ( ) => {
0 commit comments