The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.
TypeScript agentai-chatai-studioall-in-onecoding-agentdesktop-appfluximage-generationlinuxllmlocal-ailocal-llmopen-sourceprivacyself-hostedstable-diffusionuncensoreduncensored-aivideo-generationwindows
fix(gallery): two quick clicks both count in the selection (D3, Mac run)
purpledc674a32d470
diff --git a/src/components/create/experimental/CreatePanel.tsx b/src/components/create/experimental/CreatePanel.tsxindex c3f60841..a939a570 100644--- a/src/components/create/experimental/CreatePanel.tsx+++ b/src/components/create/experimental/CreatePanel.tsx@@ -54,7 +54,9 @@ export function CreatePanel({ open, onOpenChange, activeId, onSelect }: Props) {const onTileClick = (e: ReactMouseEvent, id: string) => {const mods = { toggle: e.metaKey || e.ctrlKey, range: e.shiftKey }- setSel(clickSelection(sel, order, id, mods))+ // From the state, not from this render: two clicks can land before the+ // next render (seen on the Mac), and the first must not be lost.+ setSel((prev) => clickSelection(keepShown(prev, order), order, id, mods))if (!mods.toggle && !mods.range) onSelect(id)}const onTileMenu = (e: ReactMouseEvent, id: string) => {diff --git a/src/components/create/experimental/__tests__/galerie-mehrfachauswahl.test.tsx b/src/components/create/experimental/__tests__/galerie-mehrfachauswahl.test.tsxindex ff32d7f4..8481e7a5 100644--- a/src/components/create/experimental/__tests__/galerie-mehrfachauswahl.test.tsx+++ b/src/components/create/experimental/__tests__/galerie-mehrfachauswahl.test.tsx@@ -10,7 +10,7 @@* Run: npx vitest run src/components/create/experimental/__tests__/galerie-mehrfachauswahl.test.tsx*/import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'-import { cleanup, fireEvent, render, screen, waitFor, within } from '@testing-library/react'+import { act, cleanup, fireEvent, render, screen, waitFor, within } from '@testing-library/react'vi.mock('../CreateContext', () => ({useCreateExp: () => ({ quota: null, enhanceVideo: vi.fn() }),@@ -65,6 +65,22 @@ describe('selecting', () => {expect(bar()!.textContent).toContain('2 selected')})+ it('two clicks before the next render both count (Mac run, D3 probe)', () => {+ panel()+ const click = (id: string, init: MouseEventInit) =>+ tile(id).dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true, ...init }))+ act(() => {+ click('a', { metaKey: true })+ click('c', { metaKey: true })+ })+ expect(selected()).toEqual(['a', 'c'])+ act(() => {+ click('b', {})+ click('d', { shiftKey: true })+ })+ expect(selected()).toEqual(['b', 'c', 'd'])+ })+it('Shift-click takes the range from the last clicked item', () => {panel()fireEvent.click(tile('a'))