Skip to content

Commit 00a3190

Browse files
Autoadjust comment dialog (codesandbox#3868)
* fix positioning dialog after reply render * remove my awesome suggestion ;-D Co-authored-by: Christian Alfoni <[email protected]>
1 parent f9eb98b commit 00a3190

File tree

1 file changed

+18
-5
lines changed
  • packages/app/src/app/pages/Sandbox/Editor/Workspace/screens/Comments/Dialog

1 file changed

+18
-5
lines changed

packages/app/src/app/pages/Sandbox/Editor/Workspace/screens/Comments/Dialog/index.tsx

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ export const Dialog: React.FC = () => {
7777
isCodeComment,
7878
isNewComment,
7979
repliesRendered,
80+
comment.comments.length,
8081
]);
8182

8283
React.useEffect(() => {
@@ -492,7 +493,14 @@ const Replies = ({ replies, replyCount, listRef, repliesRenderedCallback }) => {
492493
skeletonController.set({ height: SKELETON_HEIGHT, opacity: 1 });
493494
setStepInTimeline(0);
494495
}
495-
}, [skeletonController, repliesController, replies.length, T, replyCount]);
496+
}, [
497+
skeletonController,
498+
repliesController,
499+
replies.length,
500+
T,
501+
replyCount,
502+
repliesRenderedCallback,
503+
]);
496504

497505
/**
498506
* T = 1 (Dialog's enter animation has completed, hence the delay)
@@ -511,10 +519,14 @@ const Replies = ({ replies, replyCount, listRef, repliesRenderedCallback }) => {
511519
transition: { duration: SKELETON_FADE_DURATION },
512520
});
513521
repliesController.set({ opacity: 1 });
514-
repliesController.start({
515-
height: 'auto',
516-
transition: { duration: REPLY_TRANSITION_DURATION },
517-
});
522+
repliesController
523+
.start({
524+
height: 'auto',
525+
transition: { duration: REPLY_TRANSITION_DURATION },
526+
})
527+
.then(() => {
528+
repliesRenderedCallback();
529+
});
518530

519531
setStepInTimeline(2);
520532
} else {
@@ -529,6 +541,7 @@ const Replies = ({ replies, replyCount, listRef, repliesRenderedCallback }) => {
529541
delay,
530542
REPLY_TRANSITION_DURATION,
531543
T,
544+
repliesRenderedCallback,
532545
]);
533546

534547
/**

0 commit comments

Comments
 (0)