fix: scope back-to-top to browse, speed up reveal, reset scroll on sort change
- BackToTop now only mounts on the /browse feed (covers all / latest / popular / search) instead of every route. - Reveal animation duration cut 0.4s -> 0.25s so scrolled-in content appears faster. - ScrollToTop also watches `search`, so switching between sort views on the same /browse path (e.g. 全部资料 <-> 热门资料) returns to the top. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -11,12 +11,12 @@ import { useLocation } from "react-router-dom";
|
||||
* anchor / deep-link targets keep their own scroll handling.
|
||||
*/
|
||||
export function ScrollToTop() {
|
||||
const { pathname, hash } = useLocation();
|
||||
const { pathname, search, hash } = useLocation();
|
||||
|
||||
useEffect(() => {
|
||||
if (hash) return;
|
||||
window.scrollTo({ top: 0, left: 0 });
|
||||
}, [pathname, hash]);
|
||||
}, [pathname, search, hash]);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user