Skip to content

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

fix: show one render action on unfinished Deck cards (#11058)

Adam Eivy7d77132cb61f
diff --git a/client/src/components/decks/DeckCardGrid.jsx b/client/src/components/decks/DeckCardGrid.jsx
index a847790204..d3288f2224 100644
--- a/client/src/components/decks/DeckCardGrid.jsx
+++ b/client/src/components/decks/DeckCardGrid.jsx
@@ -110,9 +110,8 @@ export default function DeckCardGrid({
onPreview={() => onPreview(card, viewedFilename)}
onComplete={(filename) => handleRenderComplete(card.id, filename)}
onTerminalStatus={(s, error) => onRenderTerminal(card.id, s, error)}
- // The slot is the bigger of the card's two render
- // affordances, so a dead runtime has to stand it down too
- // or the button below stands down alone and reads broken.
+ // An empty slot is the card's render action, so a dead
+ // runtime must stand it down.
// A promptless slot is exempt: it opens the editor, which
// works whatever the runtime is doing.
canRender={needsPrompt || !runtimeBlocked}
@@ -203,16 +202,18 @@ export default function DeckCardGrid({
</button>
<div className="mt-auto flex w-full flex-wrap items-center justify-center gap-1">
<Pill tone={meta.tone} size="xs" icon={meta.icon}>{meta.label}</Pill>
- <button
- type="button"
- onClick={() => onRenderCard(card)}
- disabled={needsPrompt || !!inFlight || runtimeBlocked}
- title={reRenderHint}
- aria-label={reRenderHint}
- className="min-h-[32px] min-w-[32px] inline-flex shrink-0 items-center justify-center rounded text-gray-500 hover:text-port-accent hover:bg-port-accent/10 disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-transparent disabled:hover:text-gray-500"
- >
- <RefreshCw size={13} aria-hidden="true" />
- </button>
+ {refs.length > 0 ? (
+ <button
+ type="button"
+ onClick={() => onRenderCard(card)}
+ disabled={needsPrompt || !!inFlight || runtimeBlocked}
+ title={reRenderHint}
+ aria-label={reRenderHint}
+ className="min-h-[32px] min-w-[32px] inline-flex shrink-0 items-center justify-center rounded text-gray-500 hover:text-port-accent hover:bg-port-accent/10 disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-transparent disabled:hover:text-gray-500"
+ >
+ <RefreshCw size={13} aria-hidden="true" />
+ </button>
+ ) : null}
</div>
{/* Why it failed. The slot clears itself on a terminal
failure (so the card stays re-renderable), taking the
diff --git a/client/src/components/decks/DeckCardGrid.test.jsx b/client/src/components/decks/DeckCardGrid.test.jsx
index 8a7c0f4be1..9a9257b1cf 100644
--- a/client/src/components/decks/DeckCardGrid.test.jsx
+++ b/client/src/components/decks/DeckCardGrid.test.jsx
@@ -55,14 +55,18 @@ describe('DeckCardGrid', () => {
// its slot is an opening into the editor rather than a dead grey button.
const renderable = screen.getAllByRole('button', { name: /^Render Card [ad]$/ });
expect(renderable).toHaveLength(2);
+ expect(screen.getAllByRole('button', { name: /^Render / })).toHaveLength(2);
+ renderable.forEach((button) => expect(button).toBeEnabled());
fireEvent.click(renderable[0]);
+ fireEvent.click(renderable[1]);
+ expect(props.onRenderCard).toHaveBeenCalledWith(expect.objectContaining({ id: 'd' }));
expect(props.onRenderCard).toHaveBeenCalledWith(expect.objectContaining({ id: 'a' }));
const write = screen.getByRole('button', { name: 'Write a prompt for Card e' });
expect(write).toBeEnabled();
fireEvent.click(write);
expect(props.onOpenCard).toHaveBeenCalledWith(expect.objectContaining({ id: 'e' }));
- expect(props.onRenderCard).toHaveBeenCalledTimes(1);
+ expect(props.onRenderCard).toHaveBeenCalledTimes(2);
});
it('derives every badge from the card record: in-flight, rendered, failed, ready, needs prompt', () => {
@@ -90,25 +94,30 @@ describe('DeckCardGrid', () => {
const reRender = screen.getByRole('button', { name: 'Re-render Card b on Local · flux2-klein-9b · 1096×1536' });
fireEvent.click(reRender);
expect(props.onRenderCard).toHaveBeenCalledWith(expect.objectContaining({ id: 'b' }));
- // A card that has never rendered gets the same button, worded for a first run.
- expect(screen.getByRole('button', { name: 'Render Card a on Local · flux2-klein-9b · 1096×1536' })).toBeEnabled();
+ fireEvent.click(screen.getByRole('img', { name: 'Card b' }));
+ expect(props.onPreview).toHaveBeenCalledWith(expect.objectContaining({ id: 'b' }), 'b.png');
+ expect(props.onRenderCard).toHaveBeenCalledTimes(1);
});
- it('names why a card cannot be rendered rather than showing a bare dead icon', () => {
+ it('keeps queued cards out of the render actions and promptless cards on the editor path', () => {
renderGrid();
- // No prompt, and already rendering: both fixable, neither by this button.
- expect(screen.getByRole('button', { name: 'Write a prompt for Card e before rendering it' })).toBeDisabled();
- expect(screen.getByRole('button', { name: 'Card c is rendering' })).toBeDisabled();
+ const queued = screen.getByText('Card c').closest('li');
+ expect(within(queued).queryByRole('button', { name: /render/i })).toBeNull();
+ const promptless = screen.getByText('Card e').closest('li');
+ expect(within(promptless).getByRole('button', { name: 'Write a prompt for Card e' })).toBeEnabled();
+ expect(within(promptless).queryByRole('button', { name: /render/i })).toBeNull();
});
it('stands every render affordance down while the local runtime is unavailable', () => {
const props = renderGrid({ renderTarget: renderTarget({ blocked: true }) });
const blocked = screen.getAllByRole('button', { name: /the local image runtime is unavailable/ });
- // The three renderable cards' buttons, plus the empty slot of each card
- // that would otherwise offer a one-click render (a and d) — the bigger
- // affordance of the two, so leaving it live would read as broken.
- expect(blocked).toHaveLength(5);
- blocked.forEach((b) => expect(b).toBeDisabled());
+ // One action each: empty slots for a/d and the rendered card's footer.
+ expect(blocked).toHaveLength(3);
+ blocked.forEach((b) => {
+ expect(b).toBeDisabled();
+ fireEvent.click(b);
+ });
+ expect(props.onRenderCard).not.toHaveBeenCalled();
// The promptless card keeps its way out: that slot opens the editor, which
// works whatever the runtime is doing.
const write = screen.getByRole('button', { name: 'Write a prompt for Card e' });