Skip to content

Commit c3cee45

Browse files
committed
fix(skills): hide skill selection when disabled, remove dead code
1 parent 3022d66 commit c3cee45

File tree

2 files changed

+1
-30
lines changed
  • apps/sim
    • app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/skill-input
    • hooks/queries

2 files changed

+1
-30
lines changed

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/skill-input/skill-input.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export function SkillInput({
7373
}
7474

7575
const availableSkills = workspaceSkills.filter((s) => !selectedIds.has(s.id))
76-
if (availableSkills.length > 0) {
76+
if (!skillsDisabled && availableSkills.length > 0) {
7777
groups.push({
7878
section: 'Skills',
7979
items: availableSkills.map((s) => {

apps/sim/hooks/queries/skills.ts

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { createLogger } from '@sim/logger'
22
import { keepPreviousData, useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
3-
import { getQueryClient } from '@/app/_shell/providers/query-provider'
43

54
const logger = createLogger('SkillsQueries')
65
const API_ENDPOINT = '/api/skills'
@@ -25,34 +24,6 @@ export const skillsKeys = {
2524
list: (workspaceId: string) => [...skillsKeys.lists(), workspaceId] as const,
2625
}
2726

28-
/**
29-
* Extract workspaceId from the current URL path
30-
*/
31-
function getWorkspaceIdFromUrl(): string | null {
32-
if (typeof window === 'undefined') return null
33-
const match = window.location.pathname.match(/^\/workspace\/([^/]+)/)
34-
return match?.[1] ?? null
35-
}
36-
37-
/**
38-
* Get all skills from the query cache (for non-React code)
39-
*/
40-
export function getSkills(workspaceId?: string): SkillDefinition[] {
41-
if (typeof window === 'undefined') return []
42-
const wsId = workspaceId ?? getWorkspaceIdFromUrl()
43-
if (!wsId) return []
44-
const queryClient = getQueryClient()
45-
return queryClient.getQueryData<SkillDefinition[]>(skillsKeys.list(wsId)) ?? []
46-
}
47-
48-
/**
49-
* Get a specific skill from the query cache by ID or name
50-
*/
51-
export function getSkill(identifier: string, workspaceId?: string): SkillDefinition | undefined {
52-
const skills = getSkills(workspaceId)
53-
return skills.find((s) => s.id === identifier || s.name === identifier)
54-
}
55-
5627
/**
5728
* Fetch skills for a workspace
5829
*/

0 commit comments

Comments
 (0)