fix(reply modal): get mobile scroll position from hook before render

This commit is contained in:
plebeius.eth
2024-04-30 11:08:01 +02:00
parent d797dbd0bd
commit 1e91119687
4 changed files with 17 additions and 9 deletions
+2 -2
View File
@@ -24,7 +24,7 @@ const Board = () => {
const subplebbit = useSubplebbit({ subplebbitAddress });
const { createdAt, description, rules, shortAddress, state, suggested, title } = subplebbit || {};
const { showReplyModal, activeCid, openReplyModal, closeModal } = useReplyModal();
const { activeCid, closeModal, openReplyModal, showReplyModal, scrollY } = useReplyModal();
const loadingStateString = useFeedStateString(subplebbitAddresses) || t('loading');
const loadingString = <div className={styles.stateString}>{state === 'failed' ? state : <LoadingEllipsis string={loadingStateString} />}</div>;
@@ -62,7 +62,7 @@ const Board = () => {
return (
<div className={styles.content}>
{showReplyModal && activeCid && <ReplyModal closeModal={closeModal} parentCid={activeCid} />}
{showReplyModal && activeCid && <ReplyModal closeModal={closeModal} parentCid={activeCid} scrollY={scrollY} />}
{feed.length > 0 && (
<>
{rules && rules.length > 0 && <SubplebbitRules subplebbitAddress={subplebbitAddress} createdAt={createdAt} rules={rules} />}
+2 -2
View File
@@ -22,7 +22,7 @@ const PostPage = () => {
const isInDescriptionView = isDescriptionView(location.pathname, params);
const isInRulesView = isRulesView(location.pathname, params);
const { showReplyModal, activeCid, openReplyModal, closeModal } = useReplyModal();
const { activeCid, closeModal, openReplyModal, showReplyModal, scrollY } = useReplyModal();
const post = useComment({ commentCid });
const { deleted, locked, removed } = post || {};
@@ -34,7 +34,7 @@ const PostPage = () => {
return (
<div className={styles.content}>
{showReplyModal && activeCid && <ReplyModal closeModal={closeModal} parentCid={activeCid} />}
{showReplyModal && activeCid && <ReplyModal closeModal={closeModal} parentCid={activeCid} scrollY={scrollY} />}
{isInDescriptionView ? (
<SubplebbitDescription
avatarUrl={suggested?.avatarUrl}