-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: 🎸 Add See More Section #428
Conversation
useEffect(() => { | ||
if (!containerRef.current) return | ||
|
||
const updateWidth = (entries: ResizeObserverEntry[]) => { | ||
setWidth(entries[0].contentRect.width) | ||
} | ||
|
||
const resizeObserver = new ResizeObserver(updateWidth) | ||
resizeObserver.observe(containerRef.current) | ||
|
||
return () => resizeObserver.disconnect() | ||
}, []) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: let's move this to a custom hook. We could make it reusable and return the width and height.
|
||
pathRef.current?.setAttribute('d', `M${path}`) | ||
|
||
requestRef.current = requestAnimationFrame(animate) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to use a ref for this. We can use a local variable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job! There is one last comment but it should be good to merge after
|
||
const pathElement = containerRef.current?.querySelector('path') | ||
if (pathElement) { | ||
pathElement.setAttribute('d', `M${path}`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was also observing huge CPU usage in this branch and in the Wave.tsx
file the sin computation and rendering is running as fast as possible the whole time…. We should try to only compute once the sin waves values or load them from a JSON file
I have moved the implementation of the Wave Animation to PR #441 as it is not yet performant. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some leftovers
{ | ||
//Moved the wave animation to PR #441 | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{ | |
//Moved the wave animation to PR #441 | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was previously addressed in 44b8b93
Related to #384