Skip to content

Commit

Permalink
chore(client): remove side effects in computed properties
Browse files Browse the repository at this point in the history
  • Loading branch information
webfansplz committed Mar 19, 2024
1 parent ed3c06e commit 3a49f35
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 62 deletions.
5 changes: 4 additions & 1 deletion packages/client/src/components/pages/RoutePathItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@ function parseExpressRoute(route: string) {
const partsInput = ref<string[]>([])
const parts = computed(() => {
const _ = parseExpressRoute(props.route.path)
partsInput.value = Array.from({ length: _.length }, () => '')
return _
})
watchEffect(() => {
partsInput.value = Array.from({ length: parts.value.length }, () => '')
})
const path = computed(() => parts.value.map((i, idx) => i[0] === ':' ? partsInput.value[idx] : i).join('').replace(/\/+/g, '/'))
const hasWildcard = computed(() => props.route.path.includes(':'))
Expand Down
79 changes: 18 additions & 61 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3a49f35

Please sign in to comment.