Comments (8)
Spawning the async task with tokio is probabl causing this, just move the task out of it
spawn(async move {
while let Ok(event) = terminal_event_rx.recv() {
match event {
TerminalEvent::Redraw {
lines,
cursor,
scroll_top,
} => {
*rendered_lines.write() = lines;
*rendered_cursor.write() = (cursor.x, cursor.y as usize);
*rendered_scroll_top.write() = scroll_top;
}
}
}
});
from freya.
Moving it outside the tokio task will actually block the main thread & the app freezes. I tried using std::thread::spawn
instead of dioxus spawn but the error still persist.
from freya.
Can't you just use a non-blocking, async-friendly channel instead of crossbeam ? Like https://docs.rs/tokio/latest/tokio/sync/mpsc/fn.unbounded_channel.html
from freya.
I've just switched to flume
to have async recv channel:
https://github.com/ZeroX-DG/raven/blob/db0b86052b4fbc101562990d9678c19df2482dd0/src/components/content_area.rs#L63
But now I run into the old bug in #602. Maybe something is blocking the thread again 😢 I'll investigate more.
from freya.
Can you try with tokio just in case?
from freya.
Btw I wonder if for the terminal renderer it would be better to use the canvas directly, that would surely be more performant
from freya.
Yep. Same thing happen using tokio channel.
thread 'main' panicked at /Users/viethung/.cargo/git/checkouts/freya-aa88117f1f713ee2/7b68806/crates/core/src/dom/mutations_writer.rs:46:60:
called `Option::unwrap()` on a `None` value
Here's my branch for the tokio channel if you want to check it out:
https://github.com/ZeroX-DG/raven/tree/tokio-channel
from freya.
But yeah. Implementing in cavas would indeed be more performant & avoid blocking UI thread problem. I'll try that instead!
from freya.
Related Issues (20)
- enhancement: `ResizableContainer` component
- enhancement: `Tab` and `Tabsbar` components
- enhancement: Support nested routes in `ActivableRoute`
- enhancement: Replace selected text with the new insert in `TextEditor` HOT 1
- enhancement: Transaction-like grouping of `EditorHistory` changes
- enhancement: Use `garde` in `use_form`
- enhancement: Tree builder utilities for components
- enhancement: Also draw wireframe over hovered element in devtools besides the one selected
- enhancement: Adjust `Graph` with the current scale factor
- enhancement: Signal-based reactivity for `use_canvas`
- bug: `on_setup` never invoked in LaunchConfig.
- issue: Unexpected layout HOT 2
- enhancement: Vertical align for text HOT 1
- enhancement: Only emit keydown events after window focus event
- idea: Canvas snapshots for testing
- enhancement: Cursor style
- enhancement: Add text selection to EditorHistory
- enhancement: Click an element to focus it in the devtools
- enhancement: Change scroll wheel direction based on the scroll view direction
- bug: `mouseleave` events are not emitted after the window gets resize on its own (e.g maximized)
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 freya.