Comments (29)
Ok commenting out the resize
definitely helps. But without commenting it, the app still crash with your latest changes on the branch:
EId(99.13) Element(ElementNode { tag: Rect, attributes: {Layer: Text("-10"), Width: Text("8.4"), Background: Text("rgb(165, 172, 186)"), PositionTop: Text("0"), Height: Text("18"), Color: Text("rgb(17, 21, 28)"), PositionLeft: Text("42"), Position: Text("absolute")}, listeners: {} }) 8
EId(191.12) Element(ElementNode { tag: Rect, attributes: {}, listeners: {} }) 9
EId(70.10) Element(ElementNode { tag: Label, attributes: {}, listeners: {} }) 10
Removing...
Removing...
Removing...
EId(65.13) Element(ElementNode { tag: Rect, attributes: {Layer: Text("-10"), Width: Text("8.4"), Background: Text("rgb(165, 172, 186)"), PositionTop: Text("0"), Height: Text("18"), Color: Text("rgb(17, 21, 28)"), PositionLeft: Text("8.4"), Position: Text("absolute")}, listeners: {} }) 8
EId(187.11) Element(ElementNode { tag: Rect, attributes: {}, listeners: {} }) 9
EId(64.14) Element(ElementNode { tag: Label, attributes: {}, listeners: {} }) 10
Removing...
Removing...
Removing...
Removing...
Removing...
Removing...
EId(60.18) Element(ElementNode { tag: Rect, attributes: {Layer: Text("-10"), Width: Text("8.4"), Background: Text("rgb(165, 172, 186)"), PositionTop: Text("0"), Height: Text("18"), Color: Text("rgb(17, 21, 28)"), PositionLeft: Text("8.4"), Position: Text("absolute")}, listeners: {} }) 8
thread 'main' panicked at /Users/viethung/.cargo/git/checkouts/freya-aa88117f1f713ee2/f62e9d5/crates/core/src/dom/mutations_writer.rs:49:60:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at /Users/viethung/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.15/src/platform_impl/macos/app_state.rs:387:33:
called `Result::unwrap()` on an `Err` value: PoisonError { .. }
from freya.
Just pushed my other idea, can you try it @ZeroX-DG ?
from freya.
Having the resize run in the separate thread seems to fix it as well!
from freya.
Just pushed my other idea
Yeah that still crash unfortunately 😄
from freya.
Nice, although you should probably organize it another way so you don't spawn a thread every time the app gets resized haha, mpsc would do fine here
Yeah for sure haha. This make me wish we have something like a use_separate_thread
hook haha.
from freya.
Not specifying it could lead to DOM inconsistencies, I wonder if that's related
Hmmmm could be..........I'll try specifying a key.
from freya.
I don't really know if this is a bug or more like an issue caused by "wrong use" of the library (blocking the main thread unexpectedly)?
Yeah I agree. It's probably not a bug. More of a user error. Still, it's a chance for improvement. Maybe we can somehow let users know when their code is valid to run on the main thread & when it's not?
from freya.
Oh cool. I've never used it before. Coming from JavaScript land, these multi-threading stuff is pretty new to me haha. I'll give it a try!
from freya.
I don't really know if this is a bug or more like an issue caused by "wrong use" of the library (blocking the main thread unexpectedly)?
Yeah I agree. It's probably not a bug. More of a user error. Still, it's a chance for improvement. Maybe we can somehow let users know when their code is valid to run on the main thread & when it's not?
A note on the docs would be very nice indeed, most frameworks let you know that the UI thread should not be blocked and that expensive calculations should be done in secondary threads or similar
from freya.
Looks like some kind of edge case I missed, will look into it asap!
from freya.
hey, I can't reproduce it, so I pushed a branch with some logs which could help me debug it -> https://github.com/marc2332/freya/tree/fix/mutations-writer-error
Could you run your app with it and share me the logs once it crashes?
from freya.
Would also appreciate it if you could narrow it down in your app
from freya.
Hey, here's the resulting log:
EId(58.0) Element(ElementNode { tag: Rect, attributes: {Layer: Text("-10"), Width: Text("8.4"), Background: Text("rgb(165, 172, 186)"), PositionTop: Text("0"), Height: Text("18"), Color: Text("rgb(17, 21, 28)"), PositionLeft: Text("42"), Position: Text("absolute")}, listeners: {} }) 8
EId(59.0) Element(ElementNode { tag: Rect, attributes: {}, listeners: {} }) 9
EId(60.0) Element(ElementNode { tag: Label, attributes: {}, listeners: {} }) 10
EId(60.1) Element(ElementNode { tag: Rect, attributes: {Layer: Text("-10"), Width: Text("8.4"), Background: Text("rgb(165, 172, 186)"), PositionTop: Text("0"), Height: Text("18"), Color: Text("rgb(17, 21, 28)"), PositionLeft: Text("8.4"), Position: Text("absolute")}, listeners: {} }) 8
EId(59.1) Element(ElementNode { tag: Rect, attributes: {}, listeners: {} }) 9
EId(58.1) Element(ElementNode { tag: Label, attributes: {}, listeners: {} }) 10
EId(99.1) Element(ElementNode { tag: Rect, attributes: {Layer: Text("-10"), Width: Text("8.4"), Background: Text("rgb(165, 172, 186)"), PositionTop: Text("0"), Height: Text("18"), Color: Text("rgb(17, 21, 28)"), PositionLeft: Text("0"), Position: Text("absolute")}, listeners: {} }) 8
EId(183.0) Element(ElementNode { tag: Rect, attributes: {}, listeners: {} }) 9
EId(184.0) Element(ElementNode { tag: Label, attributes: {}, listeners: {} }) 10
EId(195.0) Element(ElementNode { tag: Rect, attributes: {Layer: Text("-10"), Width: Text("8.4"), Background: Text("rgb(165, 172, 186)"), PositionTop: Text("0"), Height: Text("18"), Color: Text("rgb(17, 21, 28)"), PositionLeft: Text("327.59998"), Position: Text("absolute")}, listeners: {} }) 8
EId(196.0) Element(ElementNode { tag: Rect, attributes: {}, listeners: {} }) 9
EId(197.0) Element(ElementNode { tag: Label, attributes: {}, listeners: {} }) 10
EId(58.3) Element(ElementNode { tag: Rect, attributes: {Layer: Text("-10"), Width: Text("8.4"), Background: Text("rgb(165, 172, 186)"), PositionTop: Text("0"), Height: Text("18"), Color: Text("rgb(17, 21, 28)"), PositionLeft: Text("42"), Position: Text("absolute")}, listeners: {} }) 8
EId(84.2) Element(ElementNode { tag: Rect, attributes: {}, listeners: {} }) 9
EId(60.3) Element(ElementNode { tag: Label, attributes: {}, listeners: {} }) 10
EId(193.1) Element(ElementNode { tag: Rect, attributes: {Layer: Text("-10"), Width: Text("8.4"), Background: Text("rgb(165, 172, 186)"), PositionTop: Text("0"), Height: Text("18"), Color: Text("rgb(17, 21, 28)"), PositionLeft: Text("16.8"), Position: Text("absolute")}, listeners: {} }) 8
EId(192.1) Element(ElementNode { tag: Rect, attributes: {}, listeners: {} }) 9
EId(191.1) Element(ElementNode { tag: Label, attributes: {}, listeners: {} }) 10
EId(59.4) Element(ElementNode { tag: Rect, attributes: {Layer: Text("-10"), Width: Text("8.4"), Background: Text("rgb(165, 172, 186)"), PositionTop: Text("0"), Height: Text("18"), Color: Text("rgb(17, 21, 28)"), PositionLeft: Text("16.8"), Position: Text("absolute")}, listeners: {} }) 8
thread 'main' panicked at ~/.cargo/git/checkouts/freya-aa88117f1f713ee2/e5c73a2/crates/core/src/dom/mutations_writer.rs:48:60:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.15/src/platform_impl/macos/app_state.rs:387:33:
called `Result::unwrap()` on an `Err` value: PoisonError { .. }
It seems like it was caused by a custom rect
that I created to represent the cursor in my terminal emulator:
I tried removing the layer
property but it still crash the app with the same error. I'll try finding out more info.
from freya.
Very strange. The node exists when we get it out using native_writer.rdom.get
but disappear when we use the realdom tree to access it. Perhaps there's a race condition somewhere...
from freya.
Very strange. The node exists when we get it out using
native_writer.rdom.get
but disappear when we use the realdom tree to access it. Perhaps there's a race condition somewhere...
I would very surprised if it was a race condition, I think it's just some weird case or something, because I have never got that error, not even on Valin, which is quite complex
from freya.
Here's a video of my replicating the bug if it helpful:
Screen.Recording.2024-05-04.at.9.43.36.PM.mov
from freya.
I wonder if you might be calling some blocking code that could be making the realdom act weird, https://github.com/ZeroX-DG/raven/blob/22685396b27e589b6d7bb3b9dcd4099ae84b2544/src/components/content_area.rs#L49
Could you try commenting tha code?
from freya.
If that's the issue I think you could try running the pty in a secondary thread and uses mpsc channels to communicate, so it doesn't block the main thread in any way
from freya.
I just pushed some changes to the branch, could try it @ZeroX-DG ?
from freya.
If that still fails, I have another idea too
from freya.
Having the resize run in the separate thread seems to fix it as well!
Nice, although you should probably organize it another way so you don't spawn a thread every time the app gets resized haha, mpsc would do fine here
from freya.
Oh wait, hold on a sec
from freya.
You are missing the key
:
rect {
key: "{line_index}",
padding: "{line_spacing} 0",
paragraph {
Not specifying it could lead to DOM inconsistencies, I wonder if that's related
from freya.
Nope still crash.
from freya.
Leave the key anyway, I guess running it in another thread is the way to go then. I don't really know if this is a bug or more like an issue caused by "wrong use" of the library (blocking the main thread unexpectedly)?
Having a use_thread
hook for Dioxus SDK would be cool
from freya.
You could also try using async tasks and a async Mutex instead of std's Mutex
from freya.
You could also try using async tasks and a async Mutex instead of std's Mutex
Oh are you talking about this crate: https://docs.rs/async-mutex/latest/async_mutex/ ? Or is it something built in?
from freya.
You could also try using async tasks and a async Mutex instead of std's Mutex
Oh are you talking about this crate: https://docs.rs/async-mutex/latest/async_mutex/ ? Or is it something built in?
I was actually thinking about tokio's Mutex
from freya.
https://docs.rs/tokio/latest/tokio/sync/struct.Mutex.html
from freya.
Related Issues (20)
- bug: Cached assets are not stored in the Root Scope HOT 5
- 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
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.