Skip to content

Promises don't resolve until a QT event is raised. #864

Closed

Description

@foxt

Describe the bug
Promises queue up and don't resolve until a QT event is raised.

To Reproduce

import { QAction, QIcon,   QMenu,  QSystemTrayIcon } from "@nodegui/nodegui";
import { resolve } from "path";

const trayMenu = new QMenu();
const statusAction = new QAction();
statusAction.setText("Action");
statusAction.setEnabled(false);
trayMenu.addAction(statusAction);


trayMenu.addSeparator();
const quitAction = new QAction();
quitAction.setText("Quit");
quitAction.addEventListener('triggered',() => process.exit());
trayMenu.addAction(quitAction);

const tray = new QSystemTrayIcon();
const icon = new QIcon(resolve(__dirname, '../../ico/logo_white.bmp'));
tray.setIcon(icon);
tray.setToolTip("rblxRP");
tray.setContextMenu(trayMenu)
tray.show();

setInterval(async () => {
    console.log("waiting promise")
    await new Promise((a) => setTimeout(a, 1));
    console.log("resolved!");
},1000);

global["tray"] = tray; // To prevent win from being garbage collected.

Output is

> ./node_modules/@nodegui/qode/binaries/qode .

waiting promise
waiting promise
waiting promise
[...]

until the tray icon is clicked at which point all the promises are resolved

Expected behavior
Promises are resolved in a timely manner.

Desktop (please complete the following information):

  • OS: [e.g. Mac, Linux, Win] macOS
  • NodeGUI version 0.35.0
  • OS Version Big Sur 11.4

Activity

  1. foxt commented on Aug 9, 2021

    @foxt
    Author
    Screen.Recording.2021-08-09.at.05.05.37.mov
  2. a7ul commented on Aug 9, 2021

    @a7ul
    Collaborator

    Hi @theLMGN
    can you try the dev build of qode here #862 (comment)

  3. foxt commented on Aug 9, 2021

    @foxt
    Author

    Thanks @a7ul, can confirm that version fixes the issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions