Skip to content

Commit

Permalink
fix(ui): init state
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Dec 28, 2021
1 parent fae56b9 commit 80ba38d
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 12 deletions.
48 changes: 40 additions & 8 deletions .vscode/tasks.json
Expand Up @@ -27,23 +27,55 @@
{
"type": "npm",
"script": "ui:dev",
"problemMatcher": [],
"label": "npm: ui",
"isBackground": true,
"dependsOn": ["npm: dev"]
},
{
"type": "npm",
"script": "test",
"dependsOn": ["npm: test"],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [],
"problemMatcher": {
"owner": "typescript",
"fileLocation": "relative",
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
},
"background": {
"activeOnStart": true,
"beginsPattern": "vite",
"endsPattern": "ready in"
}
}
},
{
"type": "npm",
"script": "test",
"label": "npm: test",
"isBackground": true,
"dependsOn": ["npm: dev"],
"detail": "vitest -r test/core --api"
"detail": "vitest -r test/core --api",
"problemMatcher": {
"owner": "typescript",
"fileLocation": "relative",
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
},
"background": {
"activeOnStart": true,
"beginsPattern": "WATCH",
"endsPattern": "Waiting for"
}
}
},
{
"type": "npm",
Expand Down
8 changes: 4 additions & 4 deletions packages/ui/client/composables/state.ts
Expand Up @@ -3,13 +3,13 @@ import type { WebSocketStatus } from '@vueuse/core'
import { reactive } from 'vue'
import type { ResolvedConfig } from '#types'

export const {
file: activeFileIdRef,
} = toRefs(useUrlSearchParams<{ file: string }>('hash-params', {
export const params = useUrlSearchParams<{ file: string }>('hash-params', {
initialValue: {
file: '',
},
}))
})

export const activeFileIdRef = toRef(params, 'file')

export const ENTRY_URL = 'ws://localhost:51204/__vitest_api__'

Expand Down

0 comments on commit 80ba38d

Please sign in to comment.