Skip to content
Open
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
64 changes: 25 additions & 39 deletions packages/app/src/pages/session.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,8 @@ export default function Page() {
const messagesReady = createMemo(() => {
const id = params.id
if (!id) return true
return sync.data.message[id] !== undefined
// Ready when messages are loaded OR session exists in the list (render immediately with cached data)
return sync.data.message[id] !== undefined || sync.session.get(id) !== undefined
})
Comment on lines 320 to 325
const historyMore = createMemo(() => {
const id = params.id
Expand Down Expand Up @@ -386,7 +387,6 @@ export default function Page() {
mobileTab: "session" as "session" | "changes",
changes: "git" as ChangeMode,
newSessionWorktree: "main",
deferRender: false,
})

const [followup, setFollowup] = persisted(
Expand All @@ -404,17 +404,6 @@ export default function Page() {
}),
)

createComputed((prev) => {
const key = sessionKey()
if (key !== prev) {
setStore("deferRender", true)
requestAnimationFrame(() => {
setTimeout(() => setStore("deferRender", false), 0)
})
}
return key
}, sessionKey())

let reviewFrame: number | undefined
let refreshFrame: number | undefined
let refreshTimer: number | undefined
Expand Down Expand Up @@ -993,30 +982,28 @@ export default function Page() {
loadingClass: string
emptyClass: string
}) => (
<Show when={!store.deferRender}>
<SessionReviewTab
title={changesTitle()}
empty={reviewEmpty(input)}
diffs={reviewDiffs}
view={view}
diffStyle={input.diffStyle}
onDiffStyleChange={input.onDiffStyleChange}
onScrollRef={(el) => setTree("reviewScroll", el)}
focusedFile={tree.activeDiff}
onLineComment={(comment) => addCommentToContext({ ...comment, origin: "review" })}
onLineCommentUpdate={updateCommentInContext}
onLineCommentDelete={removeCommentFromContext}
lineCommentActions={reviewCommentActions()}
commentMentions={{
items: file.searchFilesAndDirectories,
}}
comments={comments.all()}
focusedComment={comments.focus()}
onFocusedCommentChange={comments.setFocus}
onViewFile={openReviewFile}
classes={input.classes}
/>
</Show>
<SessionReviewTab
title={changesTitle()}
empty={reviewEmpty(input)}
diffs={reviewDiffs}
view={view}
diffStyle={input.diffStyle}
onDiffStyleChange={input.onDiffStyleChange}
onScrollRef={(el) => setTree("reviewScroll", el)}
focusedFile={tree.activeDiff}
onLineComment={(comment) => addCommentToContext({ ...comment, origin: "review" })}
onLineCommentUpdate={updateCommentInContext}
onLineCommentDelete={removeCommentFromContext}
lineCommentActions={reviewCommentActions()}
commentMentions={{
items: file.searchFilesAndDirectories,
}}
comments={comments.all()}
focusedComment={comments.focus()}
onFocusedCommentChange={comments.setFocus}
onViewFile={openReviewFile}
classes={input.classes}
/>
)

const reviewPanel = () => (
Expand Down Expand Up @@ -1658,7 +1645,7 @@ export default function Page() {
const composerRegion = (placement: "dock" | "inline") => (
<SessionComposerRegion
state={composer}
ready={!store.deferRender && messagesReady()}
ready={messagesReady()}
centered={placement === "dock" && centered()}
placement={placement}
inputRef={(el) => {
Expand Down Expand Up @@ -1710,7 +1697,6 @@ export default function Page() {

return (
<div class="relative size-full overflow-hidden flex flex-col">
{sessionSync() ?? ""}
<SessionHeader />
Comment on lines 1699 to 1700
<div
class="flex-1 min-h-0 flex flex-col md:flex-row "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,18 +101,14 @@ export function SessionComposerRegion(props: {
createEffect(() => {
route.sessionKey()
const ready = props.ready
const delay = 140

clear()
setStore("ready", false)
if (!ready) return

frame = requestAnimationFrame(() => {
frame = undefined
timer = window.setTimeout(() => {
setStore("ready", true)
timer = undefined
}, delay)
setStore("ready", true)
})
})
Comment on lines 101 to 113

Expand Down
Loading