@@ -4,7 +4,6 @@ import type { ClientField } from 'payload'
4
4
5
5
import { getTranslation } from '@payloadcms/translations'
6
6
import { fieldAffectsData , fieldIsHiddenOrDisabled , fieldIsID , tabHasName } from 'payload/shared'
7
- import { renderToStaticMarkup } from 'react-dom/server'
8
7
9
8
import type { ReducedField } from './types.js'
10
9
@@ -195,15 +194,11 @@ export const reduceFields = ({
195
194
} )
196
195
: localizedLabel
197
196
198
- // React elements in filter options are not searchable in React Select
199
- // Extract plain text to make them filterable in dropdowns
200
- const textFromLabel = extractTextFromReactNode ( formattedLabel )
201
-
202
197
const fieldPath = pathPrefix ? createNestedClientFieldPath ( pathPrefix , field ) : field . name
203
198
204
199
const formattedField : ReducedField = {
205
200
label : formattedLabel ,
206
- plainTextLabel : textFromLabel ,
201
+ plainTextLabel : ` ${ labelPrefix ? labelPrefix + ' > ' : '' } ${ localizedLabel } ` ,
207
202
value : fieldPath ,
208
203
...fieldTypes [ field . type ] ,
209
204
field,
@@ -216,29 +211,3 @@ export const reduceFields = ({
216
211
return reduced
217
212
} , [ ] )
218
213
}
219
-
220
- /**
221
- * Extracts plain text content from a React node by removing HTML tags.
222
- * Used to make React elements searchable in filter dropdowns.
223
- */
224
- const extractTextFromReactNode = ( reactNode : React . ReactNode ) : string => {
225
- if ( ! reactNode ) {
226
- return ''
227
- }
228
- if ( typeof reactNode === 'string' ) {
229
- return reactNode
230
- }
231
-
232
- const html = renderToStaticMarkup ( reactNode )
233
-
234
- // Handle different environments (server vs browser)
235
- if ( typeof document !== 'undefined' ) {
236
- // Browser environment - use actual DOM
237
- const div = document . createElement ( 'div' )
238
- div . innerHTML = html
239
- return div . textContent || ''
240
- } else {
241
- // Server environment - use regex to strip HTML tags
242
- return html . replace ( / < [ ^ > ] * > / g, '' )
243
- }
244
- }
0 commit comments