fix: dismiss leaderboard toast cleanly#1507
Conversation
|
@Abhash-Chakraborty is attempting to deploy a commit to the recode Team on Vercel. A member of the Team first needs to authorize it. |
|
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 👇🏻
If there are any specific instructions or feedback regarding your PR, we'll provide them here. Thanks again for your contribution! 😊 |
|
✅ Synchronized metadata from Issue #1500:
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
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.currentis cleared but never set back tonull, 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.
| useEffect(() => { | ||
| if (!isInitialLoad && isSponsorsPage) { | ||
| if (timerRef.current) { | ||
| clearTimeout(timerRef.current); | ||
| } |
Summary
Ctrl Kappears 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.tsxnpx prettier --check src/theme/Root.tsx src/css/custom.cssCtrl+Kopens search.Closes #1500