This repository was archived by the owner on Oct 1, 2026. It is now read-only.
Repository navigation
Fix demo mode: use useFarmContext instead of useFarm - #2
Merged
Merged
Conversation
FarmMap and useFarmSettings were using useFarm() which relies on Clerk auth context. In demo mode, the farm ID comes from DemoFarmProvider via useFarmContext(). This was causing the map to show a loading skeleton and "Farm ID is unavailable" errors. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Greptile OverviewGreptile SummaryFixed demo mode by replacing Changes:
Architecture:
Confidence Score: 5/5
|
| Filename | Overview |
|---|---|
| app/src/components/map/FarmMap.tsx | Replaced useFarm() with useFarmContext() to support demo mode farm context from DemoFarmProvider |
| app/src/lib/convex/useFarmSettings.ts | Replaced useFarm() with useFarmContext() to get activeFarmId from demo or auth context |
Sequence Diagram
sequenceDiagram
participant Demo as Demo Route (/demo)
participant DFP as DemoFarmProvider
participant FC as FarmContext
participant FM as FarmMap
participant UFS as useFarmSettings
Note over Demo,UFS: Demo Mode Flow
Demo->>DFP: Wraps demo routes
DFP->>FC: Provides FarmContext value
Note over DFP,FC: activeFarm from DemoFarm<br/>activeFarmId from DemoAuth
FM->>FC: useFarmContext()
FC-->>FM: { activeFarm, isLoading }
Note over FM: Uses activeFarm.id<br/>instead of Clerk-based farmId
UFS->>FC: useFarmContext()
FC-->>UFS: { activeFarmId, isLoading }
Note over UFS: Uses activeFarmId<br/>for Convex queries
Note over Demo,UFS: Authenticated Mode Flow
Note over Demo: Uses FarmProvider (not DemoFarmProvider)
Note over FC: activeFarm/activeFarmId<br/>come from Clerk organizationId
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
useFarm()which relies on Clerk auth contextDemoFarmProviderviauseFarmContext()Test plan
Generated with Claude Code