Skip to content

Commit 1429c61

Browse files
sancheet230ansh7432
authored andcommitted
fix: Fix memory leak in Navbar component by updating useSpring animation (accordproject#150)
* This is my commit message Signed-off-by: sancheet230 <sancheet.p24@medhaviskillsuniversity.edu.in> * Removing unwanted comments Signed-off-by: sancheet230 <sancheet.p24@medhaviskillsuniversity.edu.in> --------- Signed-off-by: sancheet230 <sancheet.p24@medhaviskillsuniversity.edu.in> Signed-off-by: ansh7432 <anshsoni743@gmail.com>
1 parent e777df7 commit 1429c61

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

src/components/Navbar.tsx

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,12 @@ function Navbar({ scrollToFooter }: { scrollToFooter: any }) {
2222
const location = useLocation();
2323

2424
const props = useSpring({
25-
to: async (next) => {
26-
while (true) {
27-
await next({
28-
opacity: 1,
29-
boxShadow: "0px 0px 5px rgba(255, 255, 255, 1)",
30-
});
31-
await new Promise((resolve) => setTimeout(resolve, 1000));
32-
await next({
33-
opacity: 0.9,
34-
boxShadow: "0px 0px 0px rgba(255, 255, 255, 0)",
35-
});
36-
await new Promise((resolve) => setTimeout(resolve, 4000));
37-
}
38-
},
25+
loop: true,
3926
from: { opacity: 0.5, boxShadow: "0px 0px 0px rgba(255, 255, 255, 0)" },
27+
to: [
28+
{ opacity: 1, boxShadow: "0px 0px 5px rgba(255, 255, 255, 1)" },
29+
{ opacity: 0.9, boxShadow: "0px 0px 0px rgba(255, 255, 255, 0)" },
30+
],
4031
config: { duration: 1000 },
4132
});
4233

0 commit comments

Comments
 (0)