Skip to content

fix: dismiss leaderboard toast cleanly#1507

Merged
sanjay-kv merged 1 commit into
recodehive:mainfrom
Abhash-Chakraborty:Abhash/fix-toast-overlay-1500
May 13, 2026
Merged

fix: dismiss leaderboard toast cleanly#1507
sanjay-kv merged 1 commit into
recodehive:mainfrom
Abhash-Chakraborty:Abhash/fix-toast-overlay-1500

Conversation

@Abhash-Chakraborty
Copy link
Copy Markdown
Member

Summary

  • Fixes the initial leaderboard toast auto-dismiss so the toast is actually unmounted instead of fading out and leaving a hidden hitbox over the navbar.
  • Styles the Algolia navbar shortcut so Ctrl K appears as one compact badge inside the search box.

Root Cause

The initial-load toast effect changed isInitialLoad, which immediately triggered the effect cleanup and cleared the auto-dismiss timer. The CSS animation still faded the toast out, but the component stayed mounted and could block clicks.

Validation

  • npm run lint (passes with existing warnings)
  • npx eslint src/theme/Root.tsx src/components/AlgoliaSiteSearch/index.tsx
  • npx prettier --check src/theme/Root.tsx src/css/custom.css
  • Browser verified: toast auto-dismisses, navbar search opens after auto-dismiss, and Ctrl+K opens search.

Closes #1500

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 13, 2026

@Abhash-Chakraborty is attempting to deploy a commit to the recode Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions
Copy link
Copy Markdown

Thank you for submitting your pull request! 🙌 We'll review it as soon as possible. The estimated time for response is 5–8 hrs.

In the meantime, please provide all necessary screenshots and make sure you run - npm build run , command and provide a screenshot, a video recording, or an image of the update you made below, which helps speed up the review and assignment. If you have questions, reach out to LinkedIn. Your contributions are highly appreciated!😊

Note: I maintain the repo issue every day twice at 8:00 AM IST and 9:00 PM IST. If your PR goes stale for more than one day, you can tag and comment on this same issue by tagging @sanjay-kv.

We are here to help you on this journey of open source. Consistent 20 contributions are eligible for sponsorship 💰

🎁 check our list of amazing people we sponsored so far: GitHub Sponsorship. ✨

📚Your perks for contribution to this community 👇🏻

  1. Get free Consultation use code recode50 to get free: Mentorship for free.

  2. Get the Ebook for free use code recode at checkout: Data Science cheatsheet for Beginners.

  3. Check out this weekly Newsletter: Sanjay's Newsletter.

If there are any specific instructions or feedback regarding your PR, we'll provide them here. Thanks again for your contribution! 😊

@github-actions github-actions Bot added in-review The current changes are in review and would need approval and testing before merging level 1 10 points recode this is label for leaderboard labels May 13, 2026
@github-actions github-actions Bot modified the milestone: recode:launch 3.0 May 13, 2026
@github-actions
Copy link
Copy Markdown

✅ Synchronized metadata from Issue #1500:

  • Labels: level 1, recode
  • Milestone: recode:launch 3.0

@Abhash-Chakraborty Abhash-Chakraborty marked this pull request as ready for review May 13, 2026 10:55
Copilot AI review requested due to automatic review settings May 13, 2026 10:55
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
recode-website Ready Ready Preview, Comment May 13, 2026 10:59am

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes the initial leaderboard toast auto-dismiss so it actually unmounts (preventing an invisible hitbox overlay from blocking navbar interactions), and refines the navbar Algolia search shortcut styling so Ctrl K renders as a single compact badge.

Changes:

  • Adjusted the initial-load toast effect to avoid clearing the auto-dismiss timeout via effect cleanup, ensuring the toast is actually removed after the delay.
  • Updated navbar CSS to render the Algolia keyboard shortcut as a single inline-flex “badge” with consistent spacing and styling.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/theme/Root.tsx Fixes initial toast timer lifecycle so auto-dismiss completes and the toast unmounts cleanly.
src/css/custom.css Styles Algolia keyboard shortcut to appear as one compact badge inside the search control.
Comments suppressed due to low confidence (1)

src/theme/Root.tsx:93

  • In the sponsors-page timer logic, timerRef.current is cleared but never set back to null, and the 10s timeout callback also doesn’t null it out. Since the initial-load effect now consistently nulls the ref on clear/fire, it’d be good to do the same here to avoid stale timeout handles and keep timer cleanup behavior consistent.

      setShowToast(false);
      const showTimer = setTimeout(() => {
        setShowToast(true);
        timerRef.current = setTimeout(() => setShowToast(false), 10000);

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/theme/Root.tsx
Comment on lines 84 to 88
useEffect(() => {
if (!isInitialLoad && isSponsorsPage) {
if (timerRef.current) {
clearTimeout(timerRef.current);
}
@sanjay-kv sanjay-kv merged commit 009aa7e into recodehive:main May 13, 2026
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in-review The current changes are in review and would need approval and testing before merging level 1 10 points recode this is label for leaderboard

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Bug: Invisible leaderboard toast overlay blocks navbar search after auto-dismiss

3 participants