-
Notifications
You must be signed in to change notification settings - Fork 839
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
[EuiSearchBar] Next.js Can't catch errors from EuiSearchBar using Errorboundary #7535
Comments
Your required const searchBarOnChange = ({ query, queryText, error }) => {
if (error) throw new Error(error);
// Do something with the query
};
<EuiSearchBar onChange={searchBarOnChange}) /> |
Thanks @cee-chen , but i have already raising the error when there is a change in the SearchBar input, |
Ah, sorry, you're right. Throwing an error from the Example: const [error, setError] = useState();
const searchBarOnChange = ({ query, queryText, error }) => {
if (error) setError(error);
// otherwise do something with the query
};
useEffect(() => {
if (error) throw new Error(error.message);
}, [error]);
return (
<EuiErrorBoundary>
<EuiSearchBar onChange={searchBarOnChange} />
</EuiErrorBoundary>
); |
Thanks for that, I used |
I have been using, Eui for Next.js, and ErrorBoundary from Next.js, to catch the error and render a fallback Component.
I have tested the fallback for error on
EuiBasicTable
, which can catch the errors, when throwing errors from the initial render, but the defaultsearch
cannot catch the error that is thrown from theonChange
function.So I used,
EuiErrorBoundary
as well but it couldn't catch the error.Can you suggest some usage or work around to catch the error from
EuiSearchBar
or in its filters.Key information
Code: https://github.com/Harshav0423/nextjs-eui/blob/main/src/app/pages/page.jsx, where I have used the EuiErrorBoundary, and commented code for ErrorBoundary from the Next.js
Thanks
The text was updated successfully, but these errors were encountered: