From 2681cf3449c30291a1f1f1c7e663939012791197 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Cl=C3=A9ment=20Roche?= <rchclement@gmail.com>
Date: Wed, 11 Dec 2024 19:36:35 +0100
Subject: [PATCH] usescrolltrigger onProgress deps

---
 .vscode/settings.json       | 3 +++
 hooks/use-scroll-trigger.ts | 4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/.vscode/settings.json b/.vscode/settings.json
index cde0409b..51890e60 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -19,5 +19,8 @@
   "css.lint.unknownAtRules": "ignore",
   "[javascript]": {
     "editor.defaultFormatter": "biomejs.biome"
+  },
+  "[typescript]": {
+    "editor.defaultFormatter": "biomejs.biome"
   }
 }
diff --git a/hooks/use-scroll-trigger.ts b/hooks/use-scroll-trigger.ts
index c82a38dd..06cdd424 100644
--- a/hooks/use-scroll-trigger.ts
+++ b/hooks/use-scroll-trigger.ts
@@ -192,7 +192,7 @@ export function useScrollTrigger(
 
   let viewportStart = isNumber(viewportStartKeyword)
     ? Number.parseFloat(viewportStartKeyword)
-    : windowHeight
+    : 0
   if (viewportStartKeyword === 'top') viewportStart = 0
   if (viewportStartKeyword === 'center') viewportStart = windowHeight * 0.5
   if (viewportStartKeyword === 'bottom') viewportStart = windowHeight
@@ -238,7 +238,7 @@ export function useScrollTrigger(
         ),
       })
     },
-    [endValue, startValue, steps, onProgress]
+    [endValue, startValue, steps, ...deps]
   )
 
   // eslint-disable-next-line no-unused-vars