Skip to content

Commit

Permalink
perf: compute params once
Browse files Browse the repository at this point in the history
  • Loading branch information
posva committed Jan 6, 2024
1 parent 6a56c84 commit 322f220
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/codegen/generateRouteParams.ts
@@ -1,9 +1,10 @@
import { TreeNode } from '../core/tree'

export function generateRouteParams(node: TreeNode, isRaw: boolean): string {
// node.params is a getter so we compute it once
const nodeParams = node.params
return node.params.length > 0
? `{ ${node.params
return nodeParams.length > 0
? `{ ${nodeParams
.map(
(param) =>
`${param.paramName}${param.optional ? '?' : ''}: ` +
Expand Down

0 comments on commit 322f220

Please sign in to comment.