Skip to content

feat(web): make left column width adjustable by codex#205

Open
yzs981130 wants to merge 2 commits intotiann:mainfrom
yzs981130:codex/make-left-column-width-adjustable
Open

feat(web): make left column width adjustable by codex#205
yzs981130 wants to merge 2 commits intotiann:mainfrom
yzs981130:codex/make-left-column-width-adjustable

Conversation

@yzs981130
Copy link

Motivation

  • Ensure user-resized sessions sidebar width.

Description

  • Added state and refs (sidebarWidth, sidebarWidthRef, isDraggingSidebar) to manage size.
  • Consolidated width clamping, state update, and localStorage persistence into a single updateSidebarWidth helper and used it for pointer drag and resize-reclamp actions.

Codex Task

@yzs981130 yzs981130 changed the title Codex/make left column width adjustable feat(web): make left column width adjustable by codex Feb 23, 2026
setSidebarWidth(clamped)
if (typeof window !== 'undefined') {
window.localStorage.setItem(SIDEBAR_WIDTH_STORAGE_KEY, String(clamped))
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MINOR] [PERF] localStorage write on every pointermove

Why this is a problem: pointermove fires at high frequency; localStorage.setItem is synchronous and can block the main thread, making the resize feel janky on lower-end devices. This path runs on every drag tick.

Suggested fix:

const updateSidebarWidth = useCallback((nextWidth: number) => {
    const clamped = clampSidebarWidth(nextWidth)
    if (sidebarWidthRef.current === clamped) return
    sidebarWidthRef.current = clamped
    setSidebarWidth(clamped)
}, [clampSidebarWidth])

const persistSidebarWidth = useCallback(() => {
    if (typeof window !== 'undefined' && sidebarWidthRef.current != null) {
        window.localStorage.setItem(SIDEBAR_WIDTH_STORAGE_KEY, String(sidebarWidthRef.current))
    }
}, [])

const handlePointerUp = () => {
    persistSidebarWidth()
    setIsDraggingSidebar(false)
}

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Findings

  • [Minor] Synchronous localStorage.setItem on every pointermove may cause resize jank; consider persisting on pointerup or debouncing web/src/router.tsx:129

Summary

  • 1 minor perf issue. Residual risk: drag feels sluggish on low-end devices if left as-is.

Testing

  • Not run (automation)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant