Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] use register_listener instead of registerListener. #12486

Open
GlosZhao opened this issue Jan 23, 2025 · 2 comments
Open

[bug] use register_listener instead of registerListener. #12486

GlosZhao opened this issue Jan 23, 2025 · 2 comments
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug

Comments

@GlosZhao
Copy link

Describe the bug

When using addPluginListener, I found that registerListener is not allowed. Upon further investigation, I discovered that addPluginListener internally uses registerListener. I believe this does not conform to Rust's naming conventions, and it should be corrected to the previous register_listener.

Reproduction

return invoke(`plugin:${plugin}|registerListener`, { event, handler }).then(

Expected behavior

use register_listener instead of registerListener.

Full tauri info output

[✔] Environment
    - OS: Mac OS 15.1.1 arm64 (X64)
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.83.0 (90b35a623 2024-11-26) (Homebrew)
    ✔ cargo: 1.83.0
    ✔ rustup: 1.27.1 (2024-04-24)
    ✔ Rust toolchain: 
    - node: 18.20.2
    - pnpm: 9.10.0
    - npm: 10.5.0

[-] Packages
    - tauri 🦀: 2.1.1
    - tauri-build 🦀: 2.0.3
    - wry 🦀: 0.47.2
    - tao 🦀: 0.30.8
    - @tauri-apps/api : 2.0.0 (outdated, latest: 2.2.0)
    - @tauri-apps/cli : 2.0.3 (outdated, latest: 2.2.5)

[-] Plugins
    - tauri-plugin-shell 🦀: 2.0.2
    - @tauri-apps/plugin-shell : 2.0.0 (outdated, latest: 2.2.0)
    - tauri-plugin-http 🦀: 2.0.3
    - @tauri-apps/plugin-http : 2.0.0 (outdated, latest: 2.2.0)
    - tauri-plugin-os 🦀: 2.0.1
    - @tauri-apps/plugin-os : 2.0.0 (outdated, latest: 2.2.0)
    - tauri-plugin-fs 🦀: 2.0.3
    - @tauri-apps/plugin-fs : not installed!

[-] App
    - build-type: bundle
    - CSP:  xxxx
    - frontendDist: ../dist
    - devUrl: http://localhost:1420/
    - framework: Vue.js
    - bundler: Vite

Stack trace


Additional context

I am not clear about the rationale behind this change. I would appreciate it if I could receive a response explaining the reasoning.

@GlosZhao GlosZhao added status: needs triage This issue needs to triage, applied to new issues type: bug labels Jan 23, 2025
@FabianLars
Copy link
Member

I believe this does not conform to Rust's naming conventions

does that matter considering that rust isn't really involved here? There's no registerListener / register_listener function in rust, only in kotlin / swift.

I am not clear about the rationale behind this change. I would appreciate it if I could receive a response explaining the reasoning.

Imo it was the less breaking way to hotfix it. ref #8068 / #10196


That said, i don't know why this is the only function that does not follow snake_case naming convention (even compared to its direct counterpart remove_listener) either. Maybe @lucasfernog knows if he looked into that for the PR 🤷
If this is fixable this should really wait until the next major of course.

@GlosZhao
Copy link
Author

I believe this does not conform to Rust's naming conventions

does that matter considering that rust isn't really involved here? There's no registerListener / register_listener function in rust, only in kotlin / swift.

I am not clear about the rationale behind this change. I would appreciate it if I could receive a response explaining the reasoning.

Imo it was the less breaking way to hotfix it. ref #8068 / #10196

That said, i don't know why this is the only function that does not follow snake_case naming convention (even compared to its direct counterpart remove_listener) either. Maybe @lucasfernog knows if he looked into that for the PR 🤷 If this is fixable this should really wait until the next major of course.

Thank you for your response. I believe this was an unintended change. Referring to the Tauri documentation custom listeners should align with the official naming conventions. Otherwise, it could introduce unnecessary cognitive overhead for future maintenance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug
Projects
None yet
Development

No branches or pull requests

2 participants