Open jsprog opened 1 week ago
For the second case (to freeze hot-reload), I'm receiving this terminal message:
Rebuild needed... shutting down hot reloading.
Manually rebuild the application to view further changes.
how can I automate rebuild when requested by freya?
Hey,
Support for Dioxus hotreload is limited, can only edit static parts, this means that changing "{count}"
or any other dynamic code will lead to unexpected behaviors. You will even get the Rebuild needed... shutting down hot reloading.
message as you shared, that is when Dioxus can't simply figure out how to hotreload the code.
And no, Freya cannot request another build because it's being run through by cargo
whereas Dioxus has a custom CLI, something I am not willing to do as I prefer to just use cargo
.
That said, I might actually just remove hot reload in the next release. I don't think most people use it (I don't at least) because of how not-worth using it is. Maybe once Dioxus gets decent support for binary patching, I could support it in Freya
That said, I might actually just remove hot reload in the next release
hot-reload existed to increase productivity when coding apps, and despite the limits mentioned above, it helps saving developer's time when styling and positioning content.
And no, Freya cannot request another build because it's being run through by cargo
Maybe once Dioxus gets decent support for ....
Currently, the logs are available to recommend a manual restart, and by invoking cargo run
as a child process, we should be able to decide when to kill and re-spawn again as cargo watch -x 'cargo run'
is doing!
node run.js
// run.js
const { spawn } = require('child_process');
spawn_cargo()
function spawn_cargo() {
const child = spawn('cargo', ['run']);
child.stdout.on('data', (data) => {
console.log(`${data}`)
if (data.indexOf("Manually rebuild the application to view further changes.") > -1) {
child.kill('SIGINT')
spawn_cargo()
}
});
child.stderr.on('data', (data) => {
console.error(`${data}`)
});
child.on('error', (error) => {
console.error(`error: ${error.message}`);
});
child.on('close', (code) => {
console.log(`child process exited with code ${code}`);
});
}
Currently, the logs are available to recommend a manual restart, and by invoking
cargo run
as a child process, we should be able to decide when to kill and re-spawn again ascargo watch -x 'cargo run'
is doing!
node run.js
// run.js const { spawn } = require('child_process'); spawn_cargo() function spawn_cargo() { const child = spawn('cargo', ['run']); child.stdout.on('data', (data) => { console.log(`${data}`) if (data.indexOf("Manually rebuild the application to view further changes.") > -1) { child.kill('SIGINT') spawn_cargo() } }); child.stderr.on('data', (data) => { console.error(`${data}`) }); child.on('error', (error) => { console.error(`error: ${error.message}`); }); child.on('close', (code) => { console.log(`child process exited with code ${code}`); }); }
Yeah sure but that would require a small CLI as you can see, if you want to make a rust POC maybe I could consider it.
Let's consider the sample code below (counter)
to crash the app:
cargo run
"{count}"
with""
, then save to see the change reflecting on screento freeze hot-reload:
cargo run
count
signal"{count}"
to"count: {count}"
count
signaldevelopment environment: