mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix retain scroll position in catalog view
This commit is contained in:
@@ -471,8 +471,8 @@ const Catalog = () => {
|
||||
const fallbackImgUrl = "assets/filedeleted-res.gif";
|
||||
return (
|
||||
<Link style={{all: "unset", cursor: "pointer"}} key={`link-${index}`} to={`/p/${selectedAddress}/c/${thread.cid}`}
|
||||
onClick={() => {setSelectedThread(thread.cid); window.scrollTo(0, 0);}}>
|
||||
<div key={`thread-${index}`} className="thread">
|
||||
onClick={() => setSelectedThread(thread.cid)}>
|
||||
<div key={`thread-${index}`} className="thread">
|
||||
{commentMediaInfo?.url ? (
|
||||
<Fragment key="f-catalog">
|
||||
{commentMediaInfo?.type === "webpage" ? (
|
||||
|
||||
@@ -214,7 +214,7 @@ const SubscriptionsCatalog = () => {
|
||||
const fallbackImgUrl = "assets/filedeleted-res.gif";
|
||||
return (
|
||||
<Link style={{all: "unset", cursor: "pointer"}} key={`link-${index}`} to={`/p/${thread.subplebbitAddress}/c/${thread.cid}`}
|
||||
onClick={() => {setSelectedThread(thread.cid); window.scrollTo(0, 0);}}>
|
||||
onClick={() => setSelectedThread(thread.cid)}>
|
||||
<div key={`thread-${index}`} className="thread">
|
||||
{commentMediaInfo?.url ? (
|
||||
<Fragment key="f-catalog">
|
||||
|
||||
@@ -73,6 +73,12 @@ const Thread = () => {
|
||||
const commentMediaInfo = getCommentMediaInfo(comment);
|
||||
const fallbackImgUrl = "assets/filedeleted-res.gif";
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
window.scrollTo(0, 0);
|
||||
}, []);
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
if ( comment.state === "failed" && selectedAddress === undefined) {
|
||||
navigate('/404');
|
||||
|
||||
Reference in New Issue
Block a user