Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EuiSearchBox][React@18 Legacy Mode] useLayoutEffect in search_box #8047

Merged
merged 2 commits into from
Sep 26, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
useLayouEffect in search_box component
  • Loading branch information
Dosant committed Sep 26, 2024
commit 71f530b468d2975647e6c6cf85e58c40e2d77a71
5 changes: 2 additions & 3 deletions packages/eui/src/components/search_bar/search_box.tsx
Original file line number Diff line number Diff line change
@@ -6,9 +6,8 @@
* Side Public License, v 1.
*/

import React, { FunctionComponent, useRef } from 'react';
import React, { FunctionComponent, useRef, useLayoutEffect } from 'react';

import { useUpdateEffect } from '../../services';
import { useEuiI18n } from '../i18n';
import { EuiFieldSearch, EuiFieldSearchProps } from '../form';
import { EuiInputPopover } from '../popover';
@@ -39,7 +38,7 @@ export const EuiSearchBox: FunctionComponent<EuiSearchBoxProps> = ({
}) => {
const inputRef = useRef<HTMLInputElement | null>(null);

useUpdateEffect(() => {
useLayoutEffect(() => {
if (inputRef.current) {
inputRef.current.value = query;
inputRef.current.dispatchEvent(new Event('change'));
Loading