mirror of
https://seed.radicle.dev/rad:z4D5UCArafTzTQpDZNQRuqswh3ury.git
synced 2026-10-18 19:10:45 +08:00
Put invoke timing logs behind VITE_LOG_INVOKE_TIMINGS
They flooded the dev console and test logs; perf work can turn them on.
This commit is contained in:
@@ -28,6 +28,9 @@ npm run tauri dev # full Tauri dev build with hot reload
|
||||
npm run start:http # Vite dev server backed by test-http-api (no Tauri runtime)
|
||||
```
|
||||
|
||||
Set `VITE_LOG_INVOKE_TIMINGS=true` to log each command's duration
|
||||
(`[invoke] <command> <ms>ms`) to the browser console. It is off by default.
|
||||
|
||||
### Checks and linting (tsc, svelte-check, eslint, prettier)
|
||||
|
||||
```sh
|
||||
|
||||
@@ -40,6 +40,14 @@ To start the app in development mode with hot reload:
|
||||
npm run dev
|
||||
```
|
||||
|
||||
To log how long every backend command takes, for performance work, set
|
||||
`VITE_LOG_INVOKE_TIMINGS=true`. Each call then prints `[invoke] <command> <ms>ms`
|
||||
to the browser console (visible at debug level):
|
||||
|
||||
```
|
||||
VITE_LOG_INVOKE_TIMINGS=true npm run dev
|
||||
```
|
||||
|
||||
## Releasing
|
||||
|
||||
Releases are driven by an interactive, phased script. Start one with:
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ export async function invoke<T = null>(
|
||||
args?: tauri.InvokeArgs,
|
||||
options?: tauri.InvokeOptions,
|
||||
): Promise<T> {
|
||||
if (import.meta.env.DEV) {
|
||||
if (import.meta.env.VITE_LOG_INVOKE_TIMINGS === "true") {
|
||||
const start = performance.now();
|
||||
try {
|
||||
return await withTestBackend<T>(tauri.invoke, cmd, args, options);
|
||||
|
||||
Vendored
+5
@@ -1,2 +1,7 @@
|
||||
/// <reference types="svelte" />
|
||||
/// <reference types="vite/client" />
|
||||
|
||||
interface ImportMetaEnv {
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
readonly VITE_LOG_INVOKE_TIMINGS?: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user