Comments (9)
yeah I know they are still broken but I still do not know Why it is broken as its been really hard to trace the reason for this. The example I have in there is to help trace and to know when it is finally fixed or not.
from iced_aw.
My very shallow investigation suggests this doesn't really have anything to do with this crate, ran into the exact same panic while messing with my own components, but I'd rather keep this issue open to warn others.
from iced_aw.
yeah that's fine. I suspect it has something to do with something Iced itself is doing but again its hard to track down. Like I can see where it error-ed but i cant see why it had an error. Made me feel like something thread wise is missing data. Or something ran before something else which made the data not yet appear. I will keep this comment open for others and ill point @hecrj here too.
from iced_aw.
I ran into this some days ago and created an even more minimal example before discovering this issue. Just in case it might help, it can be found here.
from iced_aw.
Preliminary analysis:
- Modal::new calls the into() implementation of MyComponent.
- into() is implemented via iced_lazy::component.
- component() calls Element::new() in component.rs, setting tree to None.
- I'm not sure how, but then diff() in modal.rs is called.
- This in turn calls state() in component.rs, setting tree to Some. So far so good.
- Then iced_nativ::user_interface::UserInterface::update calls Modal::overlay.
- Here we call ModalOverlay::new(). One of the arguments is (self.content)(). We evaluate the function that is content.
- Because of this re-evaluation, iced_lazy::component is called again.
- component(), calls Element::new() again and resets tree to None.
- Still in UserInterface::update, we run into Element::layout().
- This eventually calls Instance::rebuild_element_if_necessary in component.rs.
- And now this function expects a tree to present, but because state was never called again since step 8, it is None.
My rather uneducated guess is that this could be avoided by not making content a (function yielding an Element), but simply an Element. However I cannot fathom what would break by doing that, and I do not know the design considerations that went into making it a function.
from iced_aw.
this seems like a iced issue then if it has to do when the state is being called. I wonder if there is something we can do to ensure the state is made and set. Also no idea why they designed it that way originally.
from iced_aw.
This is an iced
issue. Component
currently breaks the Widget
contract. A proper fix isn't straightforward. I'll think about it.
In the meanwhile, we can call Widget::diff
for the content
before passing it to the ModalOverlay
to ensure the widget tree has the proper state set.
from iced_aw.
@turai and @TheComamba can you please try the latest Main branch of iced_aw. I believe the new push fixes this issue.
If this did fix the issue then Great I can release it as a patched version. But I will be probably making a breaking change on this in the next Iced release to make it a Element instead of a closure. as I see no need for it to be a closure.
from iced_aw.
@genusistimelord Nice, it works indeed! Thank you! :)
from iced_aw.
Related Issues (20)
- icons in tabbar's `IconText` Arent rendered correctly HOT 4
- ContextMenu ignores window borders HOT 6
- `Picker` widget HOT 6
- Beta Update to latest Iced Master HOT 11
- run time_picker example "use_24h" don't work HOT 1
- Tabs Closing icon HOT 2
- Compatible with iced 0.12.0? HOT 4
- Tabs causes overflow and/or overlap HOT 2
- Date Picker breaks with non-default font or font size HOT 9
- Mandatory copy trait makes it impossible to use custom message with additional parameters HOT 1
- feature request for menu - mac support HOT 1
- Can't use a PickList on a modal HOT 4
- index out of bounds in Tabs HOT 6
- Grid breaks Scrollable HOT 3
- fail to compile on the newest commit HOT 1
- A way to disable on scroll behavior in number_input HOT 1
- Card close_size extends down right when made larger HOT 2
- Grid is not scrolled together with scrollable content HOT 1
- [BUG] `tabs` panic if placed at application root HOT 3
- Numberinput requires mouse hover for keyboard input HOT 4
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 iced_aw.