From 36fa962c8a84ce09ea690e7b6ffad2234e96f4b1 Mon Sep 17 00:00:00 2001
From: YashShah20 <123072448+YashShah20@users.noreply.github.com>
Date: Tue, 17 Sep 2024 17:50:04 +0530
Subject: [PATCH] fixed optionLabel override issue - #1679 (#1681)

---
 src/Components/Filters/FilterEnumSelect.php | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/Components/Filters/FilterEnumSelect.php b/src/Components/Filters/FilterEnumSelect.php
index 2464dcea..8600f8cf 100644
--- a/src/Components/Filters/FilterEnumSelect.php
+++ b/src/Components/Filters/FilterEnumSelect.php
@@ -23,7 +23,8 @@ public function dataSource(Collection|array $enumCases): FilterEnumSelect
 
     public function execute(): FilterEnumSelect
     {
-        $optionLabel = 'value';
+        // use previously set optionLabel is set by the user
+        $optionLabel = $this->optionLabel ?? 'value';
 
         $collection = collect($this->dataSource)->map(function ($case) use (&$optionLabel) {
             $option = (array) $case;