Comments (4)
The example above might be a bit contrived, as I could move the dynamic
component to only contain the (ui/label counter)
.
However, in a project I have my own implementation of text-field
that I've forked and modified to have "disabled" and "error" states, along with button and in the future more components. The approach I'm taking is to use context for these, e.g.
(def form
(ui/dynamic
ctx
[disabled? (:disabled? @*form-state)]
(disable disabled?
(ui/column
(text-field *form-state)
(button on-submit (ui/label "Submit"))))))
This is very convenient, as I can group components together that should be disabled or have error borders & messages. However, because text-field
now needs to be re-rendered by the dynamic
parent with the new context, it loses its focus state.
from humbleui.
Yeah, that’s a known problem :( Dynamic basically re-creates entire subtree when its inputs change. New components lose parts of their state (even though everything about text-field is stored in atom, I guess I missed focus somehow). I plan to eventually replace dynamic with something more reliable, and also make sure that replacing components with similar ones doesn’t destroy any important state
from humbleui.
Tested on latest HumbleUI & can confirm this bug is still active. I was hoping some of the latest main
commits about signals & vdom might've fixed it, but I suppose neither of those solve the component-state storage problem.
I'll continue using my crudely patched version from #71 for now. I'd be willing to help on this issue but I'm not sure of the next steps or vision for it.
from humbleui.
They could solve it, but the commits were just tests, not merged into main impl. I haven’t made a decision to go with them yet
from humbleui.
Related Issues (20)
- BUG (Mac): Enabling "on top" in examples app hides window in Mission Control HOT 1
- Nested ui/draggable break themselves HOT 1
- nrepl init fails on Windows 10 HOT 3
- `[first experience]` Exception in `start-app!` HOT 6
- UnsatisfiedLinkError: Library file skija.dll not found in windows if version difference HOT 4
- Using `with-open` blows up HOT 3
- Event handlers for inputs and other widgets HOT 1
- Improve component exceptions HOT 1
- Cannot run repl, missing dependency HOT 1
- Nested draggables both get dragged when below pointer
- Scrollbar shouldn’t go below minimal size when too many elements
- Button inside nested with-bounds not firing HOT 4
- Incorrect mouse cursor when hovering over text field
- Move by word boundaries in text input with pressed Control
- Pressing Ctrl + z in the text field will result in a crash HOT 5
- Crash when pressing Ctrl+Z inside a text-field HOT 4
- Tweaks to compile with GraalVM HOT 7
- UnsatisfiedLinkError on master branch HOT 4
- Scaling on HIDPI screen HOT 11
- IME support on Wayland HOT 1
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 humbleui.