Skip to content

Commit 3a49f35

Browse files
committed
chore(client): remove side effects in computed properties
1 parent ed3c06e commit 3a49f35

File tree

2 files changed

+22
-62
lines changed

2 files changed

+22
-62
lines changed

packages/client/src/components/pages/RoutePathItem.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,13 @@ function parseExpressRoute(route: string) {
1717
const partsInput = ref<string[]>([])
1818
const parts = computed(() => {
1919
const _ = parseExpressRoute(props.route.path)
20-
partsInput.value = Array.from({ length: _.length }, () => '')
2120
return _
2221
})
2322
23+
watchEffect(() => {
24+
partsInput.value = Array.from({ length: parts.value.length }, () => '')
25+
})
26+
2427
const path = computed(() => parts.value.map((i, idx) => i[0] === ':' ? partsInput.value[idx] : i).join('').replace(/\/+/g, '/'))
2528
const hasWildcard = computed(() => props.route.path.includes(':'))
2629

pnpm-lock.yaml

Lines changed: 18 additions & 61 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)