Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: correct chip-move announcement position for a same-bucket append (#8120)
[._.]/ Adam Eivy045bfca9c37c
diff --git a/client/src/components/brain/tabs/LinksTab.jsx b/client/src/components/brain/tabs/LinksTab.jsxindex 80e04622b2..e6da5e73f2 100644--- a/client/src/components/brain/tabs/LinksTab.jsx+++ b/client/src/components/brain/tabs/LinksTab.jsx@@ -536,9 +536,17 @@ export default function LinksTab({ onRefresh }) {const data = over?.data?.current;if (!data || data.kind !== LINK_SLOT_KIND) return null;const link = active?.data?.current?.link;- const alreadyThere = !!link && link.bucketId === data.bucketId;- const bucketSize = links.filter(l => l.bucketId === data.bucketId).length + (alreadyThere ? 0 : 1);- return `position ${data.index + 1} of ${bucketSize} in ${bucketName(data.bucketId)}`;+ if (!link) return null;+ // Reuse the same helper the actual move persists with, rather than+ // hand-rolling the position math again: dropping an already-in-bucket+ // link on its own bucket's trailing "append" slot lands ONE EARLIER+ // than the raw slot index once the link's own current slot is removed+ // from under it, and only reorderLinksInBucket's insertAt adjustment+ // gets that right (see its own tests for the exact case).+ const { renumbered } = reorderLinksInBucket(links, link, data.bucketId, data.index);+ const finalIndex = renumbered.findIndex(r => r.id === link.id);+ if (finalIndex === -1) return null;+ return `position ${finalIndex + 1} of ${renumbered.length} in ${bucketName(data.bucketId)}`;};const itemLabel = (active) => {const data = active?.data?.current;diff --git a/client/src/components/brain/tabs/LinksTab.test.jsx b/client/src/components/brain/tabs/LinksTab.test.jsxindex c48f9c2d65..8e40764f73 100644--- a/client/src/components/brain/tabs/LinksTab.test.jsx+++ b/client/src/components/brain/tabs/LinksTab.test.jsx@@ -491,12 +491,31 @@ describe('LinksTab drag-and-drop wiring', () => {getBrainLinks.mockResolvedValue({ links: twoInBucket });await renderTab();+ // Slot index 2 is the trailing "append to the end" slot for a 2-chip+ // bucket — dropping Alpha (currently index 0) there moves it after Charlie.const active = { data: { current: { kind: LINK_KIND, link: twoInBucket[0], bucketId: 'b1', index: 0 } } };- const over = { data: { current: { kind: LINK_SLOT_KIND, bucketId: 'b1', index: 1 } } };+ const over = { data: { current: { kind: LINK_SLOT_KIND, bucketId: 'b1', index: 2 } } };const message = dndState.context.accessibility.announcements.onDragEnd({ active, over });expect(message).toBe('Moved Alpha to position 2 of 2 in Reading.');});+ it('announces the position a link stays at when dropped back on its own current slot', async () => {+ const twoInBucket = [+ link('a', 'none', { bucketId: 'b1', bucketOrder: 0, title: 'Alpha' }),+ link('c', 'none', { bucketId: 'b1', bucketOrder: 1, title: 'Charlie' }),+ ];+ getBrainLinks.mockResolvedValue({ links: twoInBucket });+ await renderTab();++ // Slot index 1 ("insert before Charlie") is exactly Alpha's current+ // position — the regression this guards was reporting "position 3 of 2"+ // by not accounting for the dragged link's own slot disappearing first.+ const active = { data: { current: { kind: LINK_KIND, link: twoInBucket[0], bucketId: 'b1', index: 0 } } };+ const over = { data: { current: { kind: LINK_SLOT_KIND, bucketId: 'b1', index: 1 } } };+ const message = dndState.context.accessibility.announcements.onDragEnd({ active, over });+ expect(message).toBe('Moved Alpha to position 1 of 2 in Reading.');+ });+it('announces the destination position when a bucket drag ends', async () => {getBrainLinks.mockResolvedValue({ links: [] });await renderTab();