Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

revert removal of useEffect, fix table search focus (#7486)

Myles Scolnick6b1f7ea55637
diff --git a/frontend/src/components/data-table/SearchBar.tsx b/frontend/src/components/data-table/SearchBar.tsx
index 9c7091d996..ba9a79624d 100644
--- a/frontend/src/components/data-table/SearchBar.tsx
+++ b/frontend/src/components/data-table/SearchBar.tsx
@@ -31,14 +31,13 @@ export const SearchBar = ({
onSearch(debouncedSearch);
}, [debouncedSearch, onSearch]);
- if (!hidden) {
- ref.current?.focus();
- }
-
- // Reset internal value when hidden becomes true
- if (hidden && internalValue !== "") {
- setInternalValue("");
- }
+ useEffect(() => {
+ if (hidden) {
+ setInternalValue("");
+ } else {
+ ref.current?.focus();
+ }
+ }, [hidden]);
return (
<div