|
59 | 59 |
|
60 | 60 | let lanesSrollableEl = $state<HTMLDivElement>();
|
61 | 61 |
|
62 |
| - let isDetailsViewForcesClosed = $state(false); |
63 |
| -
|
64 | 62 | const stackService = inject(STACK_SERVICE);
|
65 | 63 | const diffService = inject(DIFF_SERVICE);
|
66 | 64 | const uncommittedService = inject(UNCOMMITTED_SERVICE);
|
|
106 | 104 | const commitId = $derived(selection.current?.commitId);
|
107 | 105 | const branchName = $derived(selection.current?.branchName);
|
108 | 106 | const upstream = $derived(selection.current?.upstream);
|
| 107 | + const previewOpen = $derived(selection.current?.previewOpen); |
109 | 108 |
|
110 | 109 | const activeSelectionId: SelectionId | undefined = $derived.by(() => {
|
111 | 110 | if (commitId) {
|
|
232 | 231 | }
|
233 | 232 |
|
234 | 233 | function onclosePreviewOnly() {
|
235 |
| - // Close the details view but keep the selection intact |
236 |
| - isDetailsViewForcesClosed = true; |
| 234 | + const source = selection.current; |
| 235 | + if (source) { |
| 236 | + selection.set({ ...source, previewOpen: false }); |
| 237 | + } |
237 | 238 | }
|
238 | 239 |
|
239 | 240 | const startCommitVisible = $derived(uncommittedService.startCommitVisible(stackId));
|
|
258 | 259 | }
|
259 | 260 |
|
260 | 261 | let isDetailsViewOpen = $derived(
|
261 |
| - !!(branchName || commitId || assignedKey || selectedFile) && !isDetailsViewForcesClosed |
| 262 | + (!!(branchName || commitId || selectedFile) && previewOpen) || !!assignedKey |
262 | 263 | );
|
263 | 264 |
|
264 |
| - // Track the current selection to detect when it changes |
265 |
| - let previousSelection = $state<{ branchName?: string; commitId?: string }>({}); |
266 |
| -
|
267 |
| - // Reset the forced closed state when selection changes to a different branch/commit |
268 |
| - $effect(() => { |
269 |
| - const currentSelection = { branchName, commitId }; |
270 |
| -
|
271 |
| - // Check if selection actually changed |
272 |
| - if ( |
273 |
| - currentSelection.branchName !== previousSelection.branchName || |
274 |
| - currentSelection.commitId !== previousSelection.commitId |
275 |
| - ) { |
276 |
| - // Selection changed, allow details view to open again |
277 |
| - isDetailsViewForcesClosed = false; |
278 |
| - previousSelection = { ...currentSelection }; |
279 |
| -
|
280 |
| - // Clear file selections from the previous context to allow auto-selection |
281 |
| - // to work properly for the new context |
282 |
| - if (activeSelectionId) { |
283 |
| - idSelection.clear(activeSelectionId); |
284 |
| - } |
285 |
| - } |
286 |
| - }); |
287 | 265 | const DETAILS_RIGHT_PADDING_REM = 1.125;
|
288 | 266 |
|
289 | 267 | // Function to update CSS custom property for details view width
|
|
0 commit comments