tauri-apps / tauri

Build smaller, faster, and more secure desktop and mobile applications with a web frontend.
https://tauri.app
Apache License 2.0
83.67k stars 2.51k forks source link

[bug] cant use args with '_' , '_' will be removed #9206

Closed laodino closed 7 months ago

laodino commented 7 months ago

Describe the bug

I'm just learning tauri serveal days ago,and i cant find the way to solve this problem. front-end code: image front-end error: image backend code: image when i use args without '_', this error wont happen. and if i change the front-end code like this: image this error also wont happen. by the way,i cant update tauri cli, it always 1.4.0 (outdated), although it is 1.5.11 in devDependencies. image

Reproduction

No response

Expected behavior

No response

Full tauri info output

[✔] Environment
    - OS: Windows 10.0.19045 X64
    ✔ WebView2: 122.0.2365.92
    ✔ MSVC:
        - Visual Studio Community 2019
        - Visual Studio Community 2022
    ✔ rustc: 1.76.0 (07dca489a 2024-02-04)
    ✔ Cargo: 1.76.0 (c84b36747 2024-01-18)
    ✔ rustup: 1.27.0 (bbb9276d2 2024-03-08)
    ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (environment override by RUSTUP_TOOLCHAIN)
    - node: 20.11.1
    - pnpm: 8.15.4
    - npm: 10.5.0

[-] Packages
    - tauri [RUST]: 1.6.1
    - tauri-build [RUST]: 1.5.1
    - wry [RUST]: 0.24.7
    - tao [RUST]: 0.16.7
    - @tauri-apps/api [NPM]: 1.5.3
    - @tauri-apps/cli [NPM]: 1.4.0 (outdated, latest: 1.5.11)

[-] App
    - build-type: bundle
    - CSP: unset
    - distDir: ../dist
    - devPath: http://localhost:1420/
    - framework: React
    - bundler: Vite

Stack trace

No response

Additional context

No response

FabianLars commented 7 months ago

If you want to keep the snake_case on the frontend you have to annotate the command with #[tauri::command(rename_all = snake_case)] instead of #[tauri::command]. We'll incorporate this info into the new docs :)