Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 7 additions & 15 deletions src/components/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,14 @@ function Navbar({ scrollToExplore }: { scrollToExplore: any }) {
const screens = useBreakpoint();
const location = useLocation();

// Fixed code with loop: true to prevent infinite loop causing memory leaks
const props = useSpring({
to: async (next) => {
while (true) {
await next({
opacity: 1,
boxShadow: "0px 0px 5px rgba(255, 255, 255, 1)",
});
await new Promise((resolve) => setTimeout(resolve, 1000));
await next({
opacity: 0.9,
boxShadow: "0px 0px 0px rgba(255, 255, 255, 0)",
});
await new Promise((resolve) => setTimeout(resolve, 4000));
}
},
loop: true, // Enable looping without using an infinite loop
from: { opacity: 0.5, boxShadow: "0px 0px 0px rgba(255, 255, 255, 0)" },
to: [
{ opacity: 1, boxShadow: "0px 0px 5px rgba(255, 255, 255, 1)" },
{ opacity: 0.9, boxShadow: "0px 0px 0px rgba(255, 255, 255, 0)" },
],
config: { duration: 1000 },
});

Expand Down Expand Up @@ -253,4 +245,4 @@ function Navbar({ scrollToExplore }: { scrollToExplore: any }) {
);
}

export default Navbar;
export default Navbar;