Comments (12)
Hi @intrnl
I tried the steps you suggested (even manually ran global.gc()
) for about half an hour. And the app didnt crash. Is there anything more that you are doing in your app?
Also. the steps suggested to solve this might not have any effect.
(global as any)._reconcile = reconciler;
This is because reconciler is aleady in the module.exports of nodejs which means it wont be garbage collected at all.
Do you have an app source which I can clone and check ?
from react-nodegui.
Also, it would be amazing if you can check this with latest nodegui and react nodegui versions aswell
from react-nodegui.
Tested on latest NodeGUI and React NodeGUI, it still happens.
I've made an example repo with the global variable commented. The app still exits after a few seconds.
$ npm run build
> [email protected] build /home/intrnl/Documents/projects/nodegui-test
> webpack --mode=production --progress
... webpack build output ...
$ npm run start
> [email protected] start /home/intrnl/Documents/projects/nodegui-test
> qode --inspect ./dist/index.js
QApplication: invalid style override passed, ignoring it.
Available styles: Windows, Fusion
Debugger listening on ws://127.0.0.1:9229/df7d2dd5-4648-49ab-b946-aafe3088a0b3
For help, see: https://nodejs.org/en/docs/inspector
Qt exited with 0
from react-nodegui.
tried the repo from @intrnl and got the same results, app closes after ~8 seconds, when i run npm run build
and npm start
(also with packaged appimage), but no problems with npm run dev
and npm start
import React from 'react';
import { Renderer, Window, Text } from '@nodegui/react-nodegui';
class App extends React.Component {
render () {
return (
<Window windowTitle='Test App'>
<Text>Hello world!</Text>
</Window>
)
}
}
Renderer.render(<App />)
trimmed the app a little bit more (removed hot) and the problem continued, but the proposed solution works
linux mint 19.2
node 12.13.1
npm 6.13.1
"@nodegui/nodegui": "^0.7.0",
"@nodegui/react-nodegui": "^0.3.0",
from react-nodegui.
@slidinghotdog @intrnl Yep, I can confirm I can reproduce this issue.
Seems like webpack bundling is causing some issues here. Need to dig a bit more deep on why this happens.
Also can you try with
<Window windowTitle='Test App'>
<View>
<Text>Hello world!</Text>
</View>
</Window>
and see if you get the same result ?
from react-nodegui.
no changes with View
, but these 2 examples didn't close:
class App extends React.Component {
state = { count: 0 };
increase = () => {
this.setState({ count: this.state.count + 1 });
};
componentDidMount() {
setInterval(this.increase, 1000);
}
render() {
return (
<Window windowTitle="Test App">
<Text>{`Hello world! ${this.state.count}`}</Text>
</Window>
);
}
}
class App extends React.Component {
state = { count: 0 };
increase = () => {
this.setState({ count: this.state.count + 1 });
};
render() {
return (
<Window windowTitle="Test App">
<Button on={{clicked:this.increase}}text={`Hello world! ${this.state.count}`}></Button>
</Window>
);
}
}
it looks like if theres any listeners it won't get gc..
from react-nodegui.
That explains why default demo example doesnt close. Thanks for the inputs! @slidinghotdog
from react-nodegui.
Okay even adding a simple
setInterval(() => {}, 100000);
at the end of any file.
Makes the process be alive!
Another test is
setTimeout(() => {
console.log("times up!");
}, 14000);
This make allows the process to stay alive for 14 secs. and after that whenever I run global.gc()
via the debugger the app closes.
So my theory is that nodejs process thinks that there are no more instructions for it to execute and then it just closes of.
So whenever a event listener is added it stays alive since it thinks it needs to wait for an instruction.
So I am guessing its not the garbage collection but simply that nodejs thinks it doesnt have any more things to execute.
from react-nodegui.
@master-atul is there any downside if u add @intrnl solution on default config for the renderer?
from react-nodegui.
No I dont think so actually. Let me run few more checks and see which solution to go with
from react-nodegui.
don't know if its a good idea, but if theres something useful to run u could also attach some default listener on mainwindow (when created or closed), or run entire app on listener after main window is created
from react-nodegui.
Released in https://github.com/nodegui/react-nodegui/releases/tag/v0.3.1
from react-nodegui.
Related Issues (20)
- Bad URL Protocol C: when running on Windows.
- react nodegui call stack exceeded error when using GridView/ BoxView components HOT 5
- What should I use to manipulate audio in react nodegui? HOT 1
- Running for the second time no Macbook M1 HOT 3
- [Question] How do I use an SVG as an app background?
- It seems that react third-party component libraries are not supported HOT 1
- RNList and FlexLayout
- process dlopen: Cannot find symbol in flat namespace
- Can I create Intel windows binary on Apple Arm M1 machine ?
- libQt5Core.so.5: version `Qt_5.15' not found
- Cannot receive close event of FileDialog HOT 2
- Can I create submenus for System Tray Menu Actions?
- Is List component same as FlatList (efficient renderer)?
- Frameless window
- qmenubar.setCornerWidget
- Getting selected text in PlainTextEdit
- QTableWidget support
- This project is unmaintained
- Add windowGeometryChanged to QMainWindowSignals to track window changes. HOT 1
- was this project die?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-nodegui.