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] Adding a listener to a child window fires events from the parent window #3302

Closed
XuluWarrior opened this issue Jan 28, 2022 · 3 comments
Assignees
Labels

Comments

@XuluWarrior
Copy link

Describe the bug

If I create a new window from a WebView and attach a listener to it, the events that the listener receives are actually from the parent window.
e.g. if I listen to tauri://move on the child window, the listener fires when the parent window moves.

Reproduction

  1. Run this code in the WebView
  function createWindow() {
    const label = Math.random().toString();
    const webview = new WebviewWindow(label);
    windowMap[label] = webview;
    webview.once('tauri://error', function () {
      onMessage("Error creating new webview")
    });
    webview.listen('tauri://move', event => console.log(event));
  }
  1. Move the child window
  2. Nothing appears in the console logs
  3. Move the parent window
  4. Move events are logged in the console.

Expected behavior

I would expect to see the move events of the child window being logged to the console. Not those of the parent.

Platform and versions

tauri-apps/tauri@next 2b9e6ccc38836b27a3850faa697e845325a3866d

Operating System - Mac OS, version 11.6.2 X64

Node.js environment
  Node.js - 14.18.2
  @tauri-apps/cli - 1.0.0-beta.10
  @tauri-apps/api - 1.0.0-beta.8

Global packages
  npm - 6.14.15
  pnpm - Not installed
  yarn - 1.22.17

Rust environment
  rustc - 1.57.0
  cargo - 1.57.0

Rust environment
  rustup - 1.24.3
  rustc - 1.57.0
  cargo - 1.57.0
  toolchain - stable-x86_64-apple-darwin (default)

App directory structure
/dist
/node_modules
/public
/src-tauri
/src

App
  tauri.rs - 1.0.0-beta.8
  build-type - bundle
  CSP - default-src blob: data: filesystem: ws: wss: http: https: tauri: asset: customprotocol: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'
  distDir - ../dist
  devPath - http://localhost:5000/
  framework - Svelte

Stack trace

No response

Additional context

No response

@XuluWarrior
Copy link
Author

I'm bumping this as it's a bit of a blocker for us.
You guys seem to be so on top of raised issues, I wondered if this one may just have been missed.

@amrbashir amrbashir added scope: core Core packages of Tauri priority: 1 high labels Feb 4, 2022
@FabianLars
Copy link
Member

FabianLars commented Feb 4, 2022

No we didn't miss it :) Our next branches are closed for over a week now in preparation for the audit changes. This together with us generally focusing on the first RC and the docs doesn't give us much time to triage issues :/

@XuluWarrior
Copy link
Author

No worries.
It's good to see good progress on the stability of the codebase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants