feat: restore correct scroll position after layout switch (#295)
release / build-web (push) Has been cancelled
release / build-bundles (aarch64-linux-gnu-gcc, arm64, linux, ubuntu-latest, linux-arm64) (push) Has been cancelled
release / build-bundles (amd64, darwin, macos-14, macos-x64) (push) Has been cancelled
release / build-bundles (amd64, linux, ubuntu-latest, linux-x64) (push) Has been cancelled
release / build-bundles (arm64, darwin, macos-14, macos-arm64) (push) Has been cancelled
release / build-bundles (x86_64-w64-mingw32-gcc, amd64, windows, ubuntu-latest, windows-x64) (push) Has been cancelled
release / publish-release (push) Has been cancelled
release / build-web (push) Has been cancelled
release / build-bundles (aarch64-linux-gnu-gcc, arm64, linux, ubuntu-latest, linux-arm64) (push) Has been cancelled
release / build-bundles (amd64, darwin, macos-14, macos-x64) (push) Has been cancelled
release / build-bundles (amd64, linux, ubuntu-latest, linux-x64) (push) Has been cancelled
release / build-bundles (arm64, darwin, macos-14, macos-arm64) (push) Has been cancelled
release / build-bundles (x86_64-w64-mingw32-gcc, amd64, windows, ubuntu-latest, windows-x64) (push) Has been cancelled
release / publish-release (push) Has been cancelled
This commit is contained in:
@@ -82,7 +82,7 @@ func (c *Controller) httpGetTaskPR(ctx *gin.Context) {
|
||||
return
|
||||
}
|
||||
if tp == nil {
|
||||
ctx.JSON(http.StatusNotFound, gin.H{"error": "no PR associated with task"})
|
||||
ctx.Status(http.StatusNoContent)
|
||||
return
|
||||
}
|
||||
ctx.JSON(http.StatusOK, tp)
|
||||
|
||||
@@ -5,7 +5,6 @@ import { useAppStore } from "@/components/state-provider";
|
||||
import { getLocalStorage } from "@/lib/local-storage";
|
||||
import { useLayoutStore } from "@/lib/state/layout-store";
|
||||
import { useDockviewStore } from "@/lib/state/dockview-store";
|
||||
import { preserveChatScrollDuringLayout } from "@/lib/state/dockview-scroll-preserve";
|
||||
import { usePanelActions } from "@/hooks/use-panel-actions";
|
||||
import { useSessionMessages } from "@/hooks/domains/session/use-session-messages";
|
||||
import { useCustomPrompts } from "@/hooks/domains/settings/use-custom-prompts";
|
||||
@@ -70,9 +69,9 @@ export function usePlanMode(resolvedSessionId: string | null, taskId: string | n
|
||||
}
|
||||
}, [resolvedSessionId, setPlanMode, addContextFile]);
|
||||
|
||||
// Preserve scroll position and re-focus chat input after dockview layout rebuild
|
||||
// Re-focus chat input after dockview layout rebuild.
|
||||
// Scroll preservation is handled by the store layout actions (before DOM rebuild).
|
||||
const refocusChatAfterLayout = useCallback(() => {
|
||||
preserveChatScrollDuringLayout();
|
||||
const unsub = useDockviewStore.subscribe((state) => {
|
||||
if (!state.isRestoringLayout) {
|
||||
unsub();
|
||||
|
||||
@@ -315,7 +315,6 @@ function useSubmitKeymap(
|
||||
return false;
|
||||
},
|
||||
"Shift-Tab": () => {
|
||||
console.log("[ShiftTab] toggling plan mode", { current: planModeEnabledRef.current });
|
||||
onPlanModeChangeRef.current?.(!planModeEnabledRef.current);
|
||||
return true;
|
||||
},
|
||||
|
||||
@@ -23,6 +23,7 @@ import {
|
||||
} from "./layout-manager";
|
||||
import { buildFileStateActions } from "./dockview-file-state";
|
||||
import { buildPanelActions, buildExtraPanelActions } from "./dockview-panel-actions";
|
||||
import { preserveChatScrollDuringLayout } from "./dockview-scroll-preserve";
|
||||
|
||||
// Re-export types and constants used by other modules
|
||||
export type { BuiltInPreset } from "./layout-manager";
|
||||
@@ -232,6 +233,7 @@ function buildVisibilityActions(set: StoreSet, get: StoreGet) {
|
||||
const { api, sidebarVisible } = get();
|
||||
if (!api) return;
|
||||
const liveWidths = captureLiveWidths(api, set);
|
||||
preserveChatScrollDuringLayout();
|
||||
if (sidebarVisible) {
|
||||
const current = fromDockviewApi(api);
|
||||
const withoutSidebar: LayoutState = {
|
||||
@@ -261,6 +263,7 @@ function buildVisibilityActions(set: StoreSet, get: StoreGet) {
|
||||
const { api, rightPanelsVisible } = get();
|
||||
if (!api) return;
|
||||
const liveWidths = captureLiveWidths(api, set);
|
||||
preserveChatScrollDuringLayout();
|
||||
if (rightPanelsVisible) {
|
||||
const current = fromDockviewApi(api);
|
||||
const withoutRight: LayoutState = {
|
||||
@@ -310,6 +313,7 @@ function buildPresetActions(set: StoreSet, get: StoreGet) {
|
||||
const { api } = get();
|
||||
if (!api) return;
|
||||
const liveWidths = captureLiveWidths(api, set);
|
||||
preserveChatScrollDuringLayout();
|
||||
// Capture dimensions before layout change — api.width can become stale
|
||||
// inside the rAF callback after dockview serialization
|
||||
const safeWidth = api.width;
|
||||
@@ -340,6 +344,7 @@ function buildPresetActions(set: StoreSet, get: StoreGet) {
|
||||
const { api } = get();
|
||||
if (!api) return;
|
||||
const liveWidths = captureLiveWidths(api, set);
|
||||
preserveChatScrollDuringLayout();
|
||||
const safeWidth = api.width;
|
||||
const safeHeight = api.height;
|
||||
set({ isRestoringLayout: true });
|
||||
|
||||
Reference in New Issue
Block a user