Skip to content

Commit 37268ea

Browse files
committed
Fix docked-panel expand and history-drag regressions
Two issues Ahmed flagged on the chat-dock PR. First, the right-side history panel's drag-resize broke once a second right-side FlexPanel mounted -- DraggableSeparator's cached useElementBounding only refreshes on size/scroll changes, not when a sibling shifts our position. Calling update() on each drag tick keeps the math honest. Second, the chat dock's collapse chevron was setting only FlexPanel's local show ref while chatStore.chatVisible stayed true, so the activity-bar icon needed two clicks to bring the panel back. FlexPanel now emits a close event the chat parent maps to chatStore.hideChat() (history panel keeps its existing local-state fallback). Also marks the route watcher as immediate so a direct hit on /chatgxy doesn't double up with the dock at hydration.
1 parent a3bd802 commit 37268ea

3 files changed

Lines changed: 14 additions & 2 deletions

File tree

client/src/components/Common/DraggableSeparator.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ onMounted(() => {
4141
});
4242
4343
const rootBoundingBox = useElementBounding(positionedParent);
44+
// useElementBounding only refreshes on size/scroll changes, not when a sibling
45+
// mounts/unmounts and shifts our position. Re-measure on each drag tick so the
46+
// math survives layout reflows triggered elsewhere (e.g. a second right-side
47+
// FlexPanel appearing or disappearing).
48+
const refreshBoundingBox = rootBoundingBox.update;
4449
4550
const { position: draggablePosition, isDragging } = useDraggable(draggable, {
4651
preventDefault: true,
@@ -66,6 +71,7 @@ watch(
6671
const borderWidth = 6;
6772
6873
function updatePosition() {
74+
refreshBoundingBox();
6975
if (props.side === "left") {
7076
handlePosition.value = draggablePosition.value.x - rootBoundingBox.left.value + borderWidth;
7177
} else {

client/src/components/Panels/FlexPanel.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const props = withDefaults(defineProps<Props>(), {
2626
2727
const emit = defineEmits<{
2828
(e: "update:reactive-width", width: number): void;
29+
(e: "close"): void;
2930
}>();
3031
3132
const localPanelWidth = ref(DEFAULT_WIDTH);
@@ -109,7 +110,10 @@ defineExpose({
109110
class="collapse-button open"
110111
:class="{ ...sideClasses, show: showToggle }"
111112
title="Close panel"
112-
@click="show = false"
113+
@click="
114+
show = false;
115+
emit('close');
116+
"
113117
@mouseenter="hoverToggle = true"
114118
@focusin="hoverToggle = true"
115119
@mouseout="hoverToggle = false"

client/src/entry/analysis/modules/Analysis.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ watch(
3232
chatStore.hideChat();
3333
}
3434
},
35+
{ immediate: true },
3536
);
3637
3738
const showCenter = ref(false);
@@ -100,7 +101,8 @@ onUnmounted(() => {
100101
v-if="showPanels && isRightPanelOpen"
101102
panel-id="chat-panel"
102103
side="right"
103-
:reactive-width.sync="chatPanelWidth">
104+
:reactive-width.sync="chatPanelWidth"
105+
@close="chatStore.hideChat()">
104106
<ChatGXY
105107
:exchange-id="activeChatId || undefined"
106108
docked

0 commit comments

Comments
 (0)