Skip to content

Commit e12c716

Browse files
committed
refactor(custom-blocks): drop the workspaceId three mutation hooks never use
`usePublishCustomBlock`, `useUpdateCustomBlock` and `useDeleteCustomBlock` each take `workspaceId?: string` and never read it. `custom-block-detail.tsx` passes it to all three. The parameter looks like it was meant to narrow the invalidation to `customBlockKeys.list(workspaceId)`, but `lists()` is the level CLAUDE.md's targeted-invalidation rule actually prescribes, and it is a correct superset. So the invalidation is right as written and the parameter is simply vestigial — removing it is the honest fix, and narrowing the key would be a separate call with its own risk of under-invalidating. Worth recording that these three were reported to me as having zero callers and therefore being dead exports. They are not: the search that produced that claim omitted `apps/sim/ee`, where all three are used. (cherry picked from commit 2d0854a)
1 parent 4c5d31e commit e12c716

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

apps/sim/ee/custom-blocks/components/custom-block-detail.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ export function CustomBlockDetail({ blockId, workspaceId, onBack }: CustomBlockD
8585
[blocks, blockId]
8686
)
8787

88-
const publish = usePublishCustomBlock(workspaceId)
89-
const update = useUpdateCustomBlock(workspaceId)
90-
const remove = useDeleteCustomBlock(workspaceId)
88+
const publish = usePublishCustomBlock()
89+
const update = useUpdateCustomBlock()
90+
const remove = useDeleteCustomBlock()
9191

9292
// Needed in both modes: the source picker (create) and the manage gate (edit).
9393
const { data: workspaces = [] } = useWorkspacesQuery()

apps/sim/hooks/queries/custom-blocks.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export function useCustomBlockUsageCounts(blockId?: string, options?: { enabled?
7575
})
7676
}
7777

78-
export function usePublishCustomBlock(workspaceId?: string) {
78+
export function usePublishCustomBlock() {
7979
const queryClient = useQueryClient()
8080
return useMutation({
8181
mutationFn: (body: PublishCustomBlockBody) => requestJson(publishCustomBlockContract, { body }),
@@ -85,7 +85,7 @@ export function usePublishCustomBlock(workspaceId?: string) {
8585
})
8686
}
8787

88-
export function useUpdateCustomBlock(workspaceId?: string) {
88+
export function useUpdateCustomBlock() {
8989
const queryClient = useQueryClient()
9090
return useMutation({
9191
mutationFn: ({ id, ...body }: UpdateCustomBlockBody & { id: string }) =>
@@ -96,7 +96,7 @@ export function useUpdateCustomBlock(workspaceId?: string) {
9696
})
9797
}
9898

99-
export function useDeleteCustomBlock(workspaceId?: string) {
99+
export function useDeleteCustomBlock() {
100100
const queryClient = useQueryClient()
101101
return useMutation({
102102
mutationFn: (id: string) => requestJson(deleteCustomBlockContract, { params: { id } }),

0 commit comments

Comments
 (0)