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(app): move useCallback before early return to fix hooks rules violation

Louis Beaumont4242225b8162
diff --git a/screenpipe-app-tauri/components/rewind/image-card.tsx b/screenpipe-app-tauri/components/rewind/image-card.tsx
index dbf8775c5..b29ff8937 100644
--- a/screenpipe-app-tauri/components/rewind/image-card.tsx
+++ b/screenpipe-app-tauri/components/rewind/image-card.tsx
@@ -269,6 +269,12 @@ export const MainImage = () => {
setNaturalDimensions(null);
}, [currentFrame?.frame_id]);
+ const handleOpenInBrowser = useCallback(() => {
+ if (currentFrame?.url) {
+ window.open(currentFrame.url, "_blank", "noopener,noreferrer");
+ }
+ }, [currentFrame?.url]);
+
if (!currentFrame) {
return (
<div className="relative col-span-3 aspect-video w-full h-full overflow-hidden rounded-lg bg-neutral-100">
@@ -278,12 +284,6 @@ export const MainImage = () => {
);
}
- const handleOpenInBrowser = useCallback(() => {
- if (currentFrame?.url) {
- window.open(currentFrame.url, "_blank", "noopener,noreferrer");
- }
- }, [currentFrame?.url]);
-
const hasValidUrl = currentFrame?.url && currentFrame.url.length > 0 && currentFrame.url !== "null";
return (
diff --git a/screenpipe-app-tauri/tsconfig.json b/screenpipe-app-tauri/tsconfig.json
index 7e47c1df1..18873514e 100644
--- a/screenpipe-app-tauri/tsconfig.json
+++ b/screenpipe-app-tauri/tsconfig.json
@@ -38,6 +38,8 @@
"exclude": [
"node_modules",
"src-tauri",
- "scripts"
+ "scripts",
+ "vitest.config.ts",
+ "vitest.setup.ts"
]
}
\ No newline at end of file