Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .claude/rules/sim-queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,7 @@ const handler = useCallback(() => {
- **Query hooks**: `useEntity`, `useEntityList`
- **Mutation hooks**: `useCreateEntity`, `useUpdateEntity`, `useDeleteEntity`
- **Fetch functions**: `fetchEntity`, `fetchEntities` (private)

## Enforcement

`scripts/check-react-query-patterns.ts` (`bun run check:react-query`, run in CI) statically enforces these conventions: every `useQuery`/`useInfiniteQuery`/`useSuspenseQuery` declares an explicit `staleTime`, inline `queryFn`s destructure `signal`, `queryKey`s reference a colocated factory rather than an inline literal, and every `*Keys` factory in `hooks/queries/**` exposes an `all` root key. `hooks/queries/**` is a zero-tolerance zone; the rest of `apps/sim/**` is ratcheted against `scripts/check-react-query-patterns.baseline.json`. For a genuine exception, put `// rq-lint-allow: <reason>` on the line directly above the flagged construct.
3 changes: 3 additions & 0 deletions .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ jobs:
- name: Zustand v5 selector audit
run: bun run check:zustand-v5

- name: React Query pattern audit
run: bun run check:react-query

- name: Verify realtime prune graph
run: bun run check:realtime-prune

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use client'

import { useState } from 'react'
import { getErrorMessage } from '@sim/utils/errors'
import { useMutation } from '@tanstack/react-query'
import {
ChipCombobox,
Expand Down Expand Up @@ -128,9 +129,7 @@ export function DemoRequestModal({ children, theme = 'dark' }: DemoRequestModalP
}

const submitError = demoMutation.isError
? demoMutation.error instanceof Error
? demoMutation.error.message
: 'Failed to submit demo request. Please try again.'
? getErrorMessage(demoMutation.error, 'Failed to submit demo request. Please try again.')
: null

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ import { createLogger } from '@sim/logger'
import { toError } from '@sim/utils/errors'
import { generateId } from '@sim/utils/id'
import { type NextRequest, NextResponse } from 'next/server'
import { resumeWorkflowExecutionContextContract } from '@/lib/api/contracts/workflows'
import {
getPauseContextDetailContract,
resumeWorkflowExecutionContextContract,
} from '@/lib/api/contracts/workflows'
import { parseRequest } from '@/lib/api/server'
import { AuthType } from '@/lib/auth/hybrid'
import { getJobQueue } from '@/lib/core/async-jobs'
Expand Down Expand Up @@ -310,7 +313,7 @@ export const GET = withRouteHandler(
params: Promise<{ workflowId: string; executionId: string; contextId: string }>
}
) => {
const parsed = await parseRequest(resumeWorkflowExecutionContextContract, request, context)
const parsed = await parseRequest(getPauseContextDetailContract, request, context)
if (!parsed.success) return parsed.response
const { workflowId, executionId, contextId } = parsed.data.params

Expand Down
Loading
Loading