Skip to content
Open
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
20 changes: 11 additions & 9 deletions apps/docs/app/api/search/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ export const revalidate = 0
const DEFAULT_SEARCH_LIMIT = 10
const MAX_SEARCH_LIMIT = 20

/** Uses PostgreSQL's simple text-search configuration for unsupported Japanese and Chinese. */
const LOCALE_MAP: Record<string, string> = {
en: 'english',
es: 'spanish',
fr: 'french',
de: 'german',
ja: 'simple',
zh: 'simple',
}

function getSearchLimit(value: unknown): number {
const limit = Number.parseInt(String(value ?? DEFAULT_SEARCH_LIMIT), 10)

Expand Down Expand Up @@ -44,15 +54,7 @@ export async function GET(request: NextRequest) {
const candidateLimit = limit * 3
const similarityThreshold = 0.6

const localeMap: Record<string, string> = {
en: 'english',
es: 'spanish',
fr: 'french',
de: 'german',
ja: 'simple', // PostgreSQL doesn't have Japanese support, use simple
zh: 'simple', // PostgreSQL doesn't have Chinese support, use simple
}
const tsConfig = localeMap[locale] || 'simple'
const tsConfig = LOCALE_MAP[locale] || 'simple'

const useVectorSearch = locale === 'en'
let vectorResults: Array<{
Expand Down
19 changes: 9 additions & 10 deletions apps/sim/app/(landing)/comparisons/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ import { JsonLd } from '@/app/(landing)/components/json-ld'
import { LandingFAQ } from '@/app/(landing)/components/landing-faq'

const baseUrl = SITE_URL
const BREADCRUMB_JSON_LD = {
'@context': 'https://schema.org',
'@type': 'BreadcrumbList',
itemListElement: [
{ '@type': 'ListItem', position: 1, name: 'Home', item: baseUrl },
{ '@type': 'ListItem', position: 2, name: 'Comparisons', item: `${baseUrl}/comparisons` },
],
}
Comment on lines +13 to +20

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Const assertions omitted

The newly hoisted BREADCRUMB_JSON_LD object lacks the repository-required as const assertion, leaving its inferred properties unnecessarily widened and mutable. The same changed-code pattern appears in LOCALE_MAP and EMPTY_VARIABLE_INFO_MAP.

Context Used: CLAUDE.md (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!


export const revalidate = 3600

Expand Down Expand Up @@ -60,15 +68,6 @@ export const metadata: Metadata = buildLandingMetadata({
})

export default function ComparisonHubPage() {
const breadcrumbJsonLd = {
'@context': 'https://schema.org',
'@type': 'BreadcrumbList',
itemListElement: [
{ '@type': 'ListItem', position: 1, name: 'Home', item: baseUrl },
{ '@type': 'ListItem', position: 2, name: 'Comparisons', item: `${baseUrl}/comparisons` },
],
}

const itemListJsonLd = {
'@context': 'https://schema.org',
'@type': 'ItemList',
Expand Down Expand Up @@ -96,7 +95,7 @@ export default function ComparisonHubPage() {

return (
<>
<JsonLd data={breadcrumbJsonLd} />
<JsonLd data={BREADCRUMB_JSON_LD} />
<JsonLd data={itemListJsonLd} />
<JsonLd data={faqJsonLd} />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { Button, cn } from '@sim/emcn'
import { generateShortId } from '@sim/utils/id'
import { formatDate, formatLatency } from '@/app/workspace/[workspaceId]/logs/utils'

const CHART_PADDING = { top: 16, right: 28, bottom: 26, left: 26 } as const

export interface LineChartPoint {
timestamp: string
value: number
Expand Down Expand Up @@ -34,7 +36,7 @@ function LineChartComponent({
const [containerWidth, setContainerWidth] = useState<number | null>(null)
const width = containerWidth ?? 0
const height = 166
const padding = { top: 16, right: 28, bottom: 26, left: 26 }
const padding = CHART_PADDING
useEffect(() => {
if (!containerRef.current) return
const element = containerRef.current
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import { useWorkflowStore } from '@/stores/workflows/workflow/store'
import type { BlockState } from '@/stores/workflows/workflow/types'

const EMPTY_VARIABLES: Variable[] = []
const EMPTY_VARIABLE_INFO_MAP: Record<string, { type: string; id: string }> = {}

/**
* Context for sharing nested navigation state between components.
Expand Down Expand Up @@ -1001,16 +1002,14 @@ export const TagDropdown: React.FC<TagDropdownProps> = ({
[inputValue, cursorPosition]
)

const emptyVariableInfoMap: Record<string, { type: string; id: string }> = {}

/**
* Computes tags, variable info, and block tag groups
*/
const { tags, variableInfoMap, blockTagGroups } = useMemo<TagComputationResult>(() => {
if (activeSourceBlockId) {
const sourceBlock = blocks[activeSourceBlockId]
if (!sourceBlock) {
return { tags: [], variableInfoMap: emptyVariableInfoMap, blockTagGroups: [] }
return { tags: [], variableInfoMap: EMPTY_VARIABLE_INFO_MAP, blockTagGroups: [] }
}

const blockConfig = getBlock(sourceBlock.type)
Expand All @@ -1034,9 +1033,9 @@ export const TagDropdown: React.FC<TagDropdownProps> = ({
},
]

return { tags: blockTags, variableInfoMap: emptyVariableInfoMap, blockTagGroups }
return { tags: blockTags, variableInfoMap: EMPTY_VARIABLE_INFO_MAP, blockTagGroups }
}
return { tags: [], variableInfoMap: emptyVariableInfoMap, blockTagGroups: [] }
return { tags: [], variableInfoMap: EMPTY_VARIABLE_INFO_MAP, blockTagGroups: [] }
}

const mergedSubBlocks = getMergedSubBlocks(activeSourceBlockId)
Expand All @@ -1063,12 +1062,12 @@ export const TagDropdown: React.FC<TagDropdownProps> = ({
},
]

return { tags: blockTags, variableInfoMap: emptyVariableInfoMap, blockTagGroups }
return { tags: blockTags, variableInfoMap: EMPTY_VARIABLE_INFO_MAP, blockTagGroups }
}

const hasInvalidBlocks = Object.values(blocks).some((block) => !block || !block.type)
if (hasInvalidBlocks) {
return { tags: [], variableInfoMap: emptyVariableInfoMap, blockTagGroups: [] }
return { tags: [], variableInfoMap: EMPTY_VARIABLE_INFO_MAP, blockTagGroups: [] }
}

const starterBlock = Object.values(blocks).find((block) => block.type === 'starter')
Expand Down
Loading