Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix: minor regression on badge click

Louis Beaumontddf4023b09f6
diff --git a/screenpipe-app-tauri/components/search-chat.tsx b/screenpipe-app-tauri/components/search-chat.tsx
index 1af7badde..0dc4983df 100644
--- a/screenpipe-app-tauri/components/search-chat.tsx
+++ b/screenpipe-app-tauri/components/search-chat.tsx
@@ -437,6 +437,14 @@ export function SearchChat() {
}
};
+ const handleBadgeClick = (value: string, type: "app" | "window") => {
+ if (type === "app") {
+ setAppName(value);
+ } else {
+ setWindowName(value);
+ }
+ };
+
const renderSearchResults = () => {
if (isLoading) {
return Array(3)
@@ -569,7 +577,9 @@ export function SearchChat() {
{item.type === "OCR" && item.content.app_name && (
<Badge
className="text-xs cursor-pointer"
- onClick={() => setAppName(item.content.app_name)}
+ onClick={() =>
+ handleBadgeClick(item.content.app_name, "app")
+ }
>
{item.content.app_name}
</Badge>
@@ -577,7 +587,9 @@ export function SearchChat() {
{item.type === "OCR" && item.content.window_name && (
<Badge
className="text-xs cursor-pointer"
- onClick={() => setWindowName(item.content.window_name)}
+ onClick={() =>
+ handleBadgeClick(item.content.window_name, "window")
+ }
>
{item.content.window_name}
</Badge>
diff --git a/screenpipe-app-tauri/components/sql-autocomplete-input.tsx b/screenpipe-app-tauri/components/sql-autocomplete-input.tsx
index cd882eb82..9164256ef 100644
--- a/screenpipe-app-tauri/components/sql-autocomplete-input.tsx
+++ b/screenpipe-app-tauri/components/sql-autocomplete-input.tsx
@@ -27,6 +27,11 @@ export function SqlAutocompleteInput({
const inputRef = useRef<HTMLInputElement>(null);
const commandRef = useRef<HTMLDivElement>(null);
+ // update local state when prop changes
+ useEffect(() => {
+ setInputValue(value);
+ }, [value]);
+
const handleSelect = (selectedValue: string) => {
onChange(selectedValue);
setInputValue(selectedValue);
@@ -36,8 +41,9 @@ export function SqlAutocompleteInput({
const handleInputChange = useCallback(
(e: React.ChangeEvent<HTMLInputElement>) => {
- setInputValue(e.target.value);
- onChange(e.target.value);
+ const newValue = e.target.value;
+ setInputValue(newValue);
+ onChange(newValue);
},
[onChange]
);
diff --git a/screenpipe-app-tauri/src-tauri/Cargo.toml b/screenpipe-app-tauri/src-tauri/Cargo.toml
index 7652f19ac..8075db26c 100644
--- a/screenpipe-app-tauri/src-tauri/Cargo.toml
+++ b/screenpipe-app-tauri/src-tauri/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "screenpipe-app"
-version = "0.2.55"
+version = "0.2.56"
description = ""
authors = ["you"]
license = ""