You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So I tried to do something similar with Sutil, and naively I used Bind.el which seems to allows to depends on a store (to me it looked similar to React hooks):
The problem is that when the stateStore is updated, Sutil re-draw the DOM and the input lose focus.
CleanShot.2024-09-20.at.22.17.16.mp4
Looking at the documentation, I found that Bind.attr ("value", ...) should be probably be used. I could perhaps, use Store.map in order to mimic how Fable.Form compose function internally but it would require quite a lot of work and means that I can't share as much logic between the different renderer as I would like.
So I am asking if it is possible to keep the focus, without using Bind.attr or is it the only way and I should look into trying to compose/map the store internally directly?
Below is a simplify code to reproduce the situation:
The introduction is a bit long, but at the end there is a small reproduction code. I felt like explaining by context could help to understand the why
The way Fable.Form works is, by composing
onChangefunctions it is able to handle any number of inputs via a singleonChangfunction.In a pure React application, the code looks like that:
With Elmish:
So I tried to do something similar with Sutil, and naively I used
Bind.elwhich seems to allows to depends on a store (to me it looked similar to React hooks):The problem is that when the
stateStoreis updated, Sutil re-draw the DOM and the input lose focus.CleanShot.2024-09-20.at.22.17.16.mp4
Looking at the documentation, I found that
Bind.attr ("value", ...)should be probably be used. I could perhaps, useStore.mapin order to mimic how Fable.Form compose function internally but it would require quite a lot of work and means that I can't share as much logic between the different renderer as I would like.So I am asking if it is possible to keep the focus, without using
Bind.attror is it the only way and I should look into trying to compose/map the store internally directly?Below is a simplify code to reproduce the situation: