@@ -2,6 +2,7 @@ import React, { useEffect, useState } from "react";
22import styles from "./debugger-picker.module.scss" ;
33import Select , { SingleValue } from "react-select" ;
44import { DebuggerPickerOptionModel } from "@/features/common/models/debugger-picker-option.model" ;
5+ import { LibraryFilterLabel } from "@/features/libraries/models/library-filters.model" ;
56
67interface PickerLabelProps {
78 label : string | null ;
@@ -19,8 +20,8 @@ interface DebuggerPickerComponentProps {
1920 label : string | null ;
2021 languageCode : string ;
2122 options : DebuggerPickerOptionModel [ ] ;
22- selectedOptionCode : DebuggerPickerOptionModel | null ;
23- handleSelection : ( value : string ) => void ;
23+ selectedOptionCode : DebuggerPickerOptionModel [ "options" ] [ 0 ] | null ;
24+ handleSelection : ( selection : string , parentLabel ?: LibraryFilterLabel ) => void
2425 placeholder : string | null ;
2526 minWidth : string | null ;
2627}
@@ -37,12 +38,14 @@ export const DebuggerPickerComponent: React.FC<
3738} ) => {
3839 const [ isClient , setIsClient ] = useState ( false ) ;
3940
40- const handleChange = ( selection : SingleValue < DebuggerPickerOptionModel > ) => {
41+ const handleChange = (
42+ selection : SingleValue < DebuggerPickerOptionModel [ "options" ] [ 0 ] >
43+ ) => {
4144 if ( ! selection ) {
4245 return ;
4346 }
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 ) ;
4649 } ;
4750
4851 useEffect ( ( ) => {
0 commit comments