fix(ai): stop querying removed MarketplaceApp fields
https://sonarly.com/issue/36996?type=bug The AI settings tools table sends a GraphQL query with fields that do not exist on Fix: I fixed the AI settings tools table by removing the invalid `findManyMarketplaceApps` query path that requested non-existent `MarketplaceApp` fields (`icon`, `universalIdentifier`). Concretely: - Removed `FIND_MANY_MARKETPLACE_APPS_FOR_TOOL_TABLE` from `SettingsToolsTable`. - Removed the marketplace-app mapping logic keyed by `universalIdentifier`. - Stopped passing `marketplaceApp` into `SettingsToolIcon`. - Simplified the applications query shape to only request fields actually used (`id`, `name`, `logo`). - Updated `SettingsToolIcon` to render custom/managed tool icons directly from `application.logo` (with the same avatar placeholder fallback), eliminating dependency on removed MarketplaceApp fields. This addresses the root cause in the correct layer (frontend GraphQL operation + rendering path) and prevents the invalid query from being sent on `/settings/ai`.
This commit is contained in:
@@ -19,10 +19,6 @@ import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
|
||||
|
||||
type ApplicationInfo = {
|
||||
name: string;
|
||||
};
|
||||
|
||||
type MarketplaceAppInfo = {
|
||||
icon: string;
|
||||
logo?: string | null;
|
||||
};
|
||||
|
||||
@@ -31,7 +27,6 @@ type SettingsToolIconProps = {
|
||||
toolName?: string;
|
||||
objectName?: string;
|
||||
application?: ApplicationInfo;
|
||||
marketplaceApp?: MarketplaceAppInfo;
|
||||
};
|
||||
|
||||
const getOperationIcon = (toolName: string): IconComponent | null => {
|
||||
@@ -90,33 +85,15 @@ export const SettingsToolIcon = ({
|
||||
toolName,
|
||||
objectName,
|
||||
application,
|
||||
marketplaceApp,
|
||||
}: SettingsToolIconProps) => {
|
||||
const { getIcon } = useIcons();
|
||||
const { theme } = useContext(ThemeContext);
|
||||
const { objectMetadataItems } = useObjectMetadataItems();
|
||||
|
||||
// Custom tools: application/marketplace icons
|
||||
if (isDefined(application) && isDefined(marketplaceApp?.logo)) {
|
||||
return (
|
||||
<Avatar
|
||||
avatarUrl={marketplaceApp?.logo ?? null}
|
||||
placeholder={application.name}
|
||||
placeholderColorSeed={application.name}
|
||||
type="squared"
|
||||
size="xs"
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
if (isDefined(marketplaceApp)) {
|
||||
const MarketplaceIcon = getIcon(marketplaceApp.icon);
|
||||
return <MarketplaceIcon size={16} />;
|
||||
}
|
||||
|
||||
if (isDefined(application)) {
|
||||
return (
|
||||
<Avatar
|
||||
avatarUrl={application.logo ?? null}
|
||||
placeholder={application.name}
|
||||
placeholderColorSeed={application.name}
|
||||
type="squared"
|
||||
|
||||
@@ -15,6 +15,7 @@ import { Table } from '@/ui/layout/table/components/Table';
|
||||
import { TableHeader } from '@/ui/layout/table/components/TableHeader';
|
||||
import { TableRow } from '@/ui/layout/table/components/TableRow';
|
||||
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
|
||||
import { TWENTY_STANDARD_APPLICATION_UNIVERSAL_IDENTIFIER } from 'twenty-shared/application';
|
||||
import { SettingsPath } from 'twenty-shared/types';
|
||||
import { getSettingsPath, isDefined } from 'twenty-shared/utils';
|
||||
import {
|
||||
@@ -36,7 +37,6 @@ import {
|
||||
SettingsToolTableRow,
|
||||
TOOL_TABLE_ROW_GRID_TEMPLATE_COLUMNS,
|
||||
} from './SettingsToolTableRow';
|
||||
import { TWENTY_STANDARD_APPLICATION_UNIVERSAL_IDENTIFIER } from 'twenty-shared/application';
|
||||
|
||||
type ToolItem = {
|
||||
identifier: string;
|
||||
@@ -53,18 +53,6 @@ const FIND_MANY_APPLICATIONS_FOR_TOOL_TABLE = gql`
|
||||
findManyApplications {
|
||||
id
|
||||
name
|
||||
universalIdentifier
|
||||
logo
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
const FIND_MANY_MARKETPLACE_APPS_FOR_TOOL_TABLE = gql`
|
||||
query FindManyMarketplaceAppsForToolTable {
|
||||
findManyMarketplaceApps {
|
||||
id
|
||||
universalIdentifier
|
||||
icon
|
||||
logo
|
||||
}
|
||||
}
|
||||
@@ -91,18 +79,9 @@ export const SettingsToolsTable = () => {
|
||||
findManyApplications: Array<{
|
||||
id: string;
|
||||
name: string;
|
||||
universalIdentifier: string;
|
||||
logo?: string | null;
|
||||
}>;
|
||||
}>(FIND_MANY_APPLICATIONS_FOR_TOOL_TABLE);
|
||||
const { data: marketplaceAppsData } = useQuery<{
|
||||
findManyMarketplaceApps: Array<{
|
||||
id: string;
|
||||
universalIdentifier: string;
|
||||
icon: string;
|
||||
logo?: string | null;
|
||||
}>;
|
||||
}>(FIND_MANY_MARKETPLACE_APPS_FOR_TOOL_TABLE);
|
||||
const { t } = useLingui();
|
||||
const [searchTerm, setSearchTerm] = useState('');
|
||||
const [showCustomTools, setShowCustomTools] = useState(true);
|
||||
@@ -166,11 +145,6 @@ export const SettingsToolsTable = () => {
|
||||
application,
|
||||
]),
|
||||
);
|
||||
const marketplaceAppByUniversalIdentifier = new Map(
|
||||
(marketplaceAppsData?.findManyMarketplaceApps ?? []).map(
|
||||
(marketplaceApp) => [marketplaceApp.universalIdentifier, marketplaceApp],
|
||||
),
|
||||
);
|
||||
|
||||
const filteredTools = allTools
|
||||
.filter((item) => {
|
||||
@@ -275,12 +249,6 @@ export const SettingsToolsTable = () => {
|
||||
const application = isDefined(item.applicationId)
|
||||
? applicationById.get(item.applicationId)
|
||||
: undefined;
|
||||
const marketplaceApp = isDefined(application)
|
||||
? marketplaceAppByUniversalIdentifier.get(
|
||||
application.universalIdentifier,
|
||||
)
|
||||
: undefined;
|
||||
|
||||
return (
|
||||
<SettingsToolTableRow
|
||||
key={item.identifier}
|
||||
@@ -290,7 +258,6 @@ export const SettingsToolsTable = () => {
|
||||
toolName={item.name}
|
||||
objectName={item.objectName ?? undefined}
|
||||
application={application}
|
||||
marketplaceApp={marketplaceApp}
|
||||
/>
|
||||
}
|
||||
name={item.name}
|
||||
|
||||
Reference in New Issue
Block a user