Skip to content

Where agent teams gather. Cross-platform team chat where AI agents are first-class teammates — with cloud or bring-your-own (Claude Code / Codex) brains.

TypeScript

fix(ship): don't sit on 'Opening contract…' when nothing is selected

bobo lid3185abe52e0
diff --git a/src/components/ShippingWorkspace.tsx b/src/components/ShippingWorkspace.tsx
index 696b286..650a6ef 100644
--- a/src/components/ShippingWorkspace.tsx
+++ b/src/components/ShippingWorkspace.tsx
@@ -128,7 +128,7 @@ export function ShippingWorkspace({ compact = false }: { compact?: boolean }) {
{showDetail && (
<main className={cn('h-full min-w-0 overflow-y-auto bg-[var(--ship-canvas)]', compact && 'absolute inset-0')}>
{compact && <button type="button" onClick={() => void select(null)} className="sticky top-0 z-20 flex h-11 w-full items-center gap-1 border-b border-ink-100 bg-cloud/95 px-3 text-[12px] font-semibold text-skype-deep backdrop-blur"><IBack className="h-4 w-4" /> {t('ship.allFeatures')}</button>}
- {loadingFeatureId === selectedId && !detail ? <Centered title={t('ship.openingContract')} /> : detail ? <FeatureDetail feature={detail} /> : <Centered title={t('ship.pickOne')} />}
+ {selectedId && loadingFeatureId === selectedId && !detail ? <Centered title={t('ship.openingContract')} /> : detail ? <FeatureDetail feature={detail} /> : <Centered title={t('ship.pickOne')} />}
</main>
)}
</div>
diff --git a/tests/shipping-empty-detail.test.ts b/tests/shipping-empty-detail.test.ts
new file mode 100644
index 0000000..68e9858
--- /dev/null
+++ b/tests/shipping-empty-detail.test.ts
@@ -0,0 +1,25 @@
+/**
+ * With nothing selected, the Shipping detail pane must offer "pick one", not
+ * sit on the "Opening contract…" placeholder forever.
+ *
+ * The store starts with `selectedId` and `loadingFeatureId` both null, so a
+ * bare `loadingFeatureId === selectedId` is true until the user clicks a
+ * feature. A workspace with no features never gets that click, and the pane
+ * stayed on the loading state. The loading branch has to require a selection.
+ *
+ * There is no React harness in this repo, so the source is what can be
+ * checked.
+ */
+import assert from 'node:assert/strict'
+import { readFile } from 'node:fs/promises'
+import { it } from 'node:test'
+
+it('the opening-contract placeholder needs a selected feature', async () => {
+ const source = await readFile(new URL('../src/components/ShippingWorkspace.tsx', import.meta.url), 'utf8')
+ const at = source.indexOf("t('ship.openingContract')")
+ assert.notEqual(at, -1, 'the opening-contract placeholder moved; this guard needs updating')
+ // The condition is the ternary test on the same line, before the placeholder.
+ const condition = source.slice(source.lastIndexOf('\n', at) + 1, at)
+ assert.match(condition, /loadingFeatureId === selectedId/, 'the loading condition changed shape; this guard needs updating')
+ assert.match(condition, /\{\s*selectedId\b[^?]*&&\s*loadingFeatureId === selectedId/, 'with nothing selected, null === null shows "Opening contract…" forever')
+})