mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-24 14:31:22 -05:00
Update company search navigation to handle missing identifiers gracefully
Modify AutocompleteSearch.tsx to remove direct use of companyId for navigation, instead handling unknown company types and missing identifiers by showing a toast and returning to search results. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 567218be-0199-4aaa-af7e-8307f67d4453 Replit-Commit-Checkpoint-Type: intermediate_checkpoint
This commit is contained in:
@@ -157,7 +157,6 @@ export function AutocompleteSearch({
|
||||
case 'company':
|
||||
const companyType = (searchResult.data as any)?.company_type;
|
||||
const companySlug = searchResult.slug;
|
||||
const companyId = searchResult.id;
|
||||
|
||||
if (companyType && companySlug) {
|
||||
switch (companyType) {
|
||||
@@ -174,23 +173,17 @@ export function AutocompleteSearch({
|
||||
navigate(`/designers/${companySlug}`);
|
||||
break;
|
||||
default:
|
||||
if (companyId) {
|
||||
navigate(`/companies/${companyId}`);
|
||||
} else {
|
||||
toast({
|
||||
title: "Navigation Error",
|
||||
description: "Unable to navigate to this company. Missing company identifier.",
|
||||
variant: "destructive",
|
||||
});
|
||||
navigate(`/search?q=${encodeURIComponent(searchResult.title)}`);
|
||||
}
|
||||
toast({
|
||||
title: "Unknown Company Type",
|
||||
description: `Unable to navigate to this company type. Showing search results instead.`,
|
||||
variant: "default",
|
||||
});
|
||||
navigate(`/search?q=${encodeURIComponent(searchResult.title)}`);
|
||||
}
|
||||
} else if (companyId) {
|
||||
navigate(`/companies/${companyId}`);
|
||||
} else {
|
||||
toast({
|
||||
title: "Navigation Error",
|
||||
description: "Unable to navigate to this company. Missing company identifier.",
|
||||
description: "Unable to navigate to this company. Missing required information.",
|
||||
variant: "destructive",
|
||||
});
|
||||
navigate(`/search?q=${encodeURIComponent(searchResult.title)}`);
|
||||
|
||||
Reference in New Issue
Block a user