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] Click event is triggered twice #2051

Open
serdardidan opened this issue Nov 13, 2024 · 4 comments · Fixed by tauri-apps/wry#1418
Open

[bug] Click event is triggered twice #2051

serdardidan opened this issue Nov 13, 2024 · 4 comments · Fixed by tauri-apps/wry#1418
Assignees
Labels
bug Something isn't working plugin: shell

Comments

@serdardidan
Copy link

Describe the bug

I followed the steps in the link below. I didn't any change the created files at all.

https://v2.tauri.app/start/create-project/

After the "npm run tauri dev" command the application worked. I clicked on the Tauri icon. Tauri link opens two web pages.

The same problem occurs in the release exe created after the "npm run tauri build -release" command.

Reproduction

Follow the steps in the link on Windows.
https://v2.tauri.app/start/create-project/

Expected behavior

https://tauri.app/ should only be opened once

Full tauri info output

[✔] Environment
    - OS: Windows 10.0.22631 x86_64 (X64)
    ✔ WebView2: 130.0.2849.80
    ✔ MSVC: Visual Studio Community 2022
    ✔ rustc: 1.82.0 (f6e511eec 2024-10-15)
    ✔ cargo: 1.82.0 (8f40fc59f 2024-08-21)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (default)
    - node: 20.13.1
    - npm: 10.5.2

[-] Packages
    - tauri 🦀: 2.1.1
    - tauri-build 🦀: 2.0.3
    - wry 🦀: 0.47.0
    - tao 🦀: 0.30.8
    - @tauri-apps/api : not installed!
    - @tauri-apps/cli : 2.1.0

[-] Plugins
    - tauri-plugin-shell 🦀: 2.0.2
    - @tauri-apps/plugin-shell : not installed!

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../src

Stack trace

No response

Additional context

Windows 11 Home 23H2

@FabianLars
Copy link
Member

FabianLars commented Nov 13, 2024

hmm it doesn't do that for me. nvm it does but only on windows

are there any noteworthy messages in the devtools console?

does this happen on every template?

@serdardidan
Copy link
Author

I created the project with the following options.

✔ Choose which language to use for your frontend · TypeScript / JavaScript - (pnpm, yarn, npm, deno, bun)
✔ Choose your package manager · npm
✔ Choose your UI template · Vanilla
✔ Choose your UI flavor · JavaScript

I see 4 lines in the network tab in Devtools.

Copy all as fetch
fetch("http://ipc.localhost/plugin%3Ashell%7Copen", {
"headers": {
"accept": "/",
"sec-fetch-mode": "cors"
},
"referrerPolicy": "strict-origin-when-cross-origin",
"body": null,
"method": "OPTIONS",
"mode": "cors",
"credentials": "omit"
}); ;
fetch("http://ipc.localhost/plugin%3Ashell%7Copen", {
"headers": {
"content-type": "application/json",
"sec-ch-ua": ""Chromium";v="130", "Microsoft Edge";v="130", "Not?A_Brand";v="99", "Microsoft Edge WebView2";v="130"",
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": ""Windows"",
"tauri-callback": "2441965313",
"tauri-error": "3679775417",
"tauri-invoke-key": "gdH/2yHa}1<Fbx7Tj@1y"
},
"referrer": "http://127.0.0.1:1430/",
"referrerPolicy": "strict-origin-when-cross-origin",
"body": "{"path":"https://tauri.app/\"}",
"method": "POST",
"mode": "cors",
"credentials": "omit"
}); ;
fetch("http://ipc.localhost/plugin%3Ashell%7Copen", {
"headers": {
"content-type": "application/json",
"sec-ch-ua": ""Chromium";v="130", "Microsoft Edge";v="130", "Not?A_Brand";v="99", "Microsoft Edge WebView2";v="130"",
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": ""Windows"",
"tauri-callback": "2549648598",
"tauri-error": "2296740436",
"tauri-invoke-key": "gdH/2yHa}1<Fbx7Tj@1y"
},
"referrer": "http://127.0.0.1:1430/",
"referrerPolicy": "strict-origin-when-cross-origin",
"body": "{"path":"https://tauri.app/\"}",
"method": "POST",
"mode": "cors",
"credentials": "omit"
}); ;
fetch("http://ipc.localhost/plugin%3Ashell%7Copen", {
"headers": {
"accept": "/",
"sec-fetch-mode": "cors"
},
"referrerPolicy": "strict-origin-when-cross-origin",
"body": null,
"method": "OPTIONS",
"mode": "cors",
"credentials": "omit"
});

@LZQCN
Copy link

LZQCN commented Nov 14, 2024

I found if the a tag contains target="blank", then two new tabs page will be created in my browser.

<a href="https://vitejs.dev" target="_blank">Test</a>

@serdardidan
Copy link
Author

I checked. There is target="_blank" in the links in index.html. When you delete target="_blank", the web page opens within the application. In this case, it doesn't seem possible to understand that it was trigger twice or once. And I prefer the web page to open in the browser.

@FabianLars FabianLars transferred this issue from tauri-apps/tauri Nov 14, 2024
@FabianLars FabianLars added bug Something isn't working plugin: shell labels Nov 14, 2024
@amrbashir amrbashir self-assigned this Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working plugin: shell
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants