Hoist the vision-capability flag to one canScan local
Build image / build-and-push (push) Successful in 11s

Review nit: capabilities.data?.vision was read inline at all three Plants-mode
scan entry points. Read it once into `canScan` so the gating is consistent.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01H3zbym8Doka2d7D48maSgZ
This commit is contained in:
2026-07-22 13:24:37 -04:00
co-authored by Claude Opus 4.8
parent f5d4e9cb19
commit df6200d858
+5 -2
View File
@@ -110,6 +110,9 @@ export function GardenEditorPage() {
const [sharing, setSharing] = useState(false)
const [clearing, setClearing] = useState(false)
const [scanning, setScanning] = useState(false)
// Whether to offer packet scanning — a vision model is configured. Read once
// here so all three Plants-mode entry points gate identically.
const canScan = !!capabilities.data?.vision
const nudgeTimer = useRef<number | null>(null)
const nudgeFire = useRef<(() => void) | null>(null)
@@ -634,7 +637,7 @@ export function GardenEditorPage() {
onClear={() => setClearing(true)}
onFill={fillBed}
filling={fillObject.isPending}
canScan={!!capabilities.data?.vision}
canScan={canScan}
onScan={() => setScanning(true)}
/>
) : (
@@ -732,7 +735,7 @@ export function GardenEditorPage() {
) : (
<div className="flex items-center gap-2">
<p className="px-1 text-xs text-muted">Tap a bed, then 🌱 Plant here to start planting.</p>
{capabilities.data?.vision && (
{canScan && (
<Button
variant="ghost"
className="ml-auto px-2 py-1 text-xs"