)]}'
{
  "commit": "65ff909493e8f27bcdc507ed27253e28c98eb5ec",
  "tree": "c5c8eb1dc785f62fa5b3843fcc3ff653200cce59",
  "parents": [
    "b774437ff57fb95b14d326cc6be2c9937bdb6a78"
  ],
  "author": {
    "name": "banksean",
    "email": "banksean@gmail.com",
    "time": "Thu Jun 19 00:36:25 2025 +0000"
  },
  "committer": {
    "name": "Sean McCullough",
    "email": "banksean@gmail.com",
    "time": "Wed Jun 18 21:22:21 2025 -0400"
  },
  "message": "webui: preserve chat scroll position when switching tabs\n\nFix scroll position preservation in SketchAppShell to maintain chat timeline\nscroll position when navigating between tabs, preventing automatic scroll\nto top when returning to the chat view.\n\nImplementation Changes:\n\n1. Scroll Position Storage:\n   - Add _chatScrollPosition state property to track chat scroll position\n   - Store scroll position when leaving chat view in toggleViewMode()\n   - Only store position if content is scrollable and user has actually scrolled\n   - Validate scrollHeight \u003e clientHeight and scrollTop \u003e 0 before storing\n\n2. Scroll Position Restoration:\n   - Restore scroll position when returning to chat view\n   - Use requestAnimationFrame to ensure DOM is ready before restoration\n   - Add safety checks to verify view mode and container connection\n   - Validate container is still connected before applying scroll position\n\n3. Smart Reset Logic:\n   - Reset stored scroll position when new messages arrive and user is near bottom\n   - Check if user is within 50px of bottom (isNearBottom) before resetting\n   - Allow timeline auto-scroll behavior for new messages when user is following\n   - Preserve position when user has scrolled up to read older messages\n\n4. Defensive Programming:\n   - Add comprehensive validation for scroll container existence\n   - Check scrollHeight, clientHeight, and scrollTop before calculations\n   - Validate viewMode matches expected state during restoration\n   - Ensure container.isConnected before DOM manipulation\n\nTechnical Details:\n- Uses existing scrollContainerRef for scroll container access\n- Maintains compatibility with existing scroll behavior in sketch-timeline\n- Preserves timeline auto-scroll for new messages when user is at bottom\n- Only stores meaningful scroll positions (not zero or invalid values)\n- Handles edge cases like rapid tab switching or container changes\n\nUser Experience:\n- Chat tab now remembers scroll position when switching to diff/terminal tabs\n- Reading older messages no longer interrupted by tab navigation\n- New messages still auto-scroll when user is following conversation\n- Smooth restoration without visible jumps or layout shifts\n\nThis resolves the issue where the chat timeline would always scroll to the\noldest message when navigating back from other tabs, significantly improving\nthe user experience when reviewing conversation history.\n\nCo-Authored-By: sketch \u003chello@sketch.dev\u003e\nChange-ID: s3a52c0413098ade3k\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "e31c8603b7a0ba894f94428628faa08400cb293d",
      "old_mode": 33188,
      "old_path": "webui/src/web-components/sketch-app-shell.test.ts",
      "new_id": "ead14ff0153035cb2ebe23bde7c64f85a7f585ec",
      "new_mode": 33188,
      "new_path": "webui/src/web-components/sketch-app-shell.test.ts"
    },
    {
      "type": "modify",
      "old_id": "e2d27a280427c46eb0e29b5ab48eb3fb419f5fb6",
      "old_mode": 33188,
      "old_path": "webui/src/web-components/sketch-app-shell.ts",
      "new_id": "d3bf00d6355b062b96edc66c56d04e6bd7e362e8",
      "new_mode": 33188,
      "new_path": "webui/src/web-components/sketch-app-shell.ts"
    }
  ]
}
