Dennis Oelkers 1a598f3dbd Fix flaky react-select crash in PaginatedSelect caused by debounce return value (#25301)
* Fix flaky react-select crash in PaginatedSelect caused by debounce return value

The handleSearch debounced callback was returning the Promise from
loadOptions(). Lodash debounce returns the result of the last invocation
on subsequent calls. When react-select's onInputChange handler received
this Promise, it checked `if (nextValue != null)` — which is truthy for
a Promise — and set its internal inputValue state to the Promise object.
On the next re-render, trimString(promise) crashed with
"str.replace is not a function".

This was a latent bug exposed by the user-event v13 → v14 migration.
In v13, userEvent.type() fired all keystrokes nearly synchronously, so
the 400ms debounce never fired between keystrokes and the wrapper always
returned undefined. In v14, keystrokes are dispatched individually with
proper async handling, giving the debounce timer a chance to fire between
keystrokes — making the crash flaky depending on execution speed.

The fix: don't return the Promise from the debounced callback, so
react-select never mistakes it for a new input value.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Fix flaky react-select crash in PaginatedSelect caused by debounce return value

The handleSearch debounced callback was returning the Promise from
loadOptions(). Lodash debounce returns the result of the last invocation
on subsequent calls. When react-select's onInputChange handler received
this Promise, it checked `if (nextValue != null)` — which is truthy for
a Promise — and set its internal inputValue state to the Promise object.
On the next re-render, trimString(promise) crashed with
"str.replace is not a function".

This was a latent bug exposed by the user-event v13 → v14 migration.
In v13, userEvent.type() fired all keystrokes nearly synchronously, so
the 400ms debounce never fired between keystrokes and the wrapper always
returned undefined. In v14, keystrokes are dispatched individually with
proper async handling, giving the debounce timer a chance to fire between
keystrokes — making the crash flaky depending on execution speed.

The fix: don't return the Promise from the debounced callback, so
react-select never mistakes it for a new input value.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 10:21:14 +01:00
2025-06-18 16:05:39 +02:00
2015-02-03 11:54:05 +01:00
2022-12-28 10:08:36 +01:00
2016-03-07 15:56:59 -06:00
2020-11-16 18:41:59 +01:00
2024-12-05 11:04:28 +01:00

Graylog

License Maven Central

Welcome! Graylog is a free and open log management platform.

You can read more about the project on our website and check out the documentation on the documentation site.

Issue Tracking

Found a bug? Have an idea for an improvement? Feel free to add an issue.

Contributing

Help us build the future of log management and be part of a project that is used by thousands of people out there every day.

Follow the contributors guide and read the contributing instructions to get started.

Do you want to get paid for developing our free and open product? Apply for one of our jobs!

Staying in Touch

Come chat with us in the #graylog channel on freenode IRC, the #graylog channel on libera or create a topic in our community discussion forums.

License

Graylog is released under version 1 of the Server Side Public License (SSPL).

Languages
Java 69%
TypeScript 30.6%
JavaScript 0.2%