Compare commits

...

1 Commits

Author SHA1 Message Date
Swifty
48fdb3fa16 fix(onboarding): Fix onboarding error when there are not two agents to provide 2025-10-28 10:23:59 +01:00
2 changed files with 22 additions and 11 deletions

View File

@@ -315,6 +315,11 @@ async def get_recommended_agents(user_id: str) -> list[StoreAgentDetails]:
agent_points.sort(key=lambda x: x[1], reverse=True)
recommended_agents = [agent for agent, _ in agent_points[:2]]
# Only return agents if we have at least 2 as frontend expects at least 2 agents
# This prevents the frontend from trying to display a partial selection
if len(recommended_agents) < 2:
return []
return [
StoreAgentDetails(
store_listing_version_id=agent.storeListingVersionId,

View File

@@ -67,12 +67,15 @@ export default function Page() {
agents[0]?.store_listing_version_id
: false
}
onClick={() =>
updateState({
selectedStoreListingVersionId: agents[0].store_listing_version_id,
agentInput: {},
})
}
onClick={() => {
if (agents[0]) {
updateState({
selectedStoreListingVersionId:
agents[0].store_listing_version_id,
agentInput: {},
});
}
}}
/>
<OnboardingAgentCard
agent={agents[1]}
@@ -82,11 +85,14 @@ export default function Page() {
agents[1]?.store_listing_version_id
: false
}
onClick={() =>
updateState({
selectedStoreListingVersionId: agents[1].store_listing_version_id,
})
}
onClick={() => {
if (agents[1]) {
updateState({
selectedStoreListingVersionId:
agents[1].store_listing_version_id,
});
}
}}
/>
</div>