How do I create a new_view inside a component in GPUI? #7120
-
To better explain my question I have created a minimum repro of the problem here. The question is why when I press the button does the counter never increment? I have only ever gotten this to work but hoisting the cx.new_view() all the way to the top level build root view where the code is only run once per new window, but surely we can create new view down the tree without needing to pass them all the way along? If anyone has worked this out it would be greatly appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 9 replies
-
On each frame you're constructing a new Counter, so it never has a chance to increment before it's dropped. Try storing the counter in the Editor :) |
Beta Was this translation helpful? Give feedback.
On each frame you're constructing a new Counter, so it never has a chance to increment before it's dropped. Try storing the counter in the Editor :)