Skip to content

[TBCCT-438/444] polishes useScrollSpy behaviour #490

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

Merged
merged 1 commit into from
Jul 28, 2025

Conversation

agnlez
Copy link
Member

@agnlez agnlez commented Jul 15, 2025

This pull request includes updates to the useScrollSpy hook and its usage in components, along with a minor import reordering. The most important changes focus on improving the logic for handling intersecting elements in the useScrollSpy hook and updating the rootMargin configuration for specific components.

Updates to useScrollSpy hook:

  • Refactored the logic in the IntersectionObserver callback to filter and handle only intersecting entries, ensuring the first intersected element is processed. If no elements are intersecting, the setCurrentStep function is called with null. This improves clarity and robustness when managing scroll-based interactions. (client/src/hooks/use-scroll-spy.ts, client/src/hooks/use-scroll-spy.tsL41-L46)

Component-specific adjustments:

  • Removed the rootMargin property from the Profile component's useScrollSpy configuration, simplifying its scroll behavior. (client/src/containers/profile/index.tsx, client/src/containers/profile/index.tsxL84)
  • Added a rootMargin property to the CustomProjectForm component's useScrollSpy configuration, fine-tuning its scroll behavior for better user experience. (client/src/containers/projects/form/index.tsx, client/src/containers/projects/form/index.tsxR48)

Code style improvement:

@agnlez agnlez self-assigned this Jul 15, 2025
Copy link

vercel bot commented Jul 15, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
tnc-blue-carbon-cost-tool-ghps ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 15, 2025 9:35am

@agnlez agnlez marked this pull request as ready for review July 28, 2025 09:57
@agnlez agnlez merged commit 1dfde95 into dev Jul 28, 2025
4 checks passed
@agnlez agnlez deleted the TBCCT-438-fe-issue-with-the-active-tab branch July 28, 2025 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant