Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions src/browser/hooks/useAutoScroll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,18 @@ export function useAutoScroll() {
}, []); // No deps - ref ensures we always check current value

const jumpToBottom = useCallback(() => {
if (contentRef.current) {
contentRef.current.scrollTop = contentRef.current.scrollHeight;
setAutoScroll(true);
}
if (!contentRef.current) return;

// Double RAF: First frame for DOM updates (async highlighting, image loads),
// second frame to scroll after layout is complete
requestAnimationFrame(() => {
requestAnimationFrame(() => {
if (contentRef.current) {
contentRef.current.scrollTop = contentRef.current.scrollHeight;
}
});
});
setAutoScroll(true);
}, []);

const handleScroll = useCallback((e: React.UIEvent<HTMLDivElement>) => {
Expand Down
5 changes: 4 additions & 1 deletion src/cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ if (subcommand === "run") {
process.argv.splice(2, 1);
// eslint-disable-next-line @typescript-eslint/no-require-imports
require("./api");
} else if (subcommand === "desktop" || (isElectron && (subcommand === undefined || isElectronLaunchArg))) {
} else if (
subcommand === "desktop" ||
(isElectron && (subcommand === undefined || isElectronLaunchArg))
) {
// Explicit `mux desktop`, or Electron runtime with no subcommand / Electron launch args
launchDesktop();
} else {
Expand Down
Loading