-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question on signal updates: formless "child" signals lose state, others don't #25
Comments
I do have a plan B (not to use formless - it seems I may not really need it for this app), but would be good to understand this. I'll try to upload some photos after I fix another minor display bug shortly. |
As we can see here, both Record Identifier and Institution Name (using I can also add data to the Institution Contact form and save it, which causes a new value to be emitted from But as soon as I add a character (an |
Any thoughts on areas to explore for this issue? I'm using concur-formless and not formless-independent, though my current guess is that wouldn't matter much. |
Hi, sorry for the delayed response, I was away on a holiday. I will take a look and get back to you. |
Thanks @ajnsit - sorry for bugging you while on vacation, hope it was a good one - and happy (belated) independence day! |
@bbarker Do you have instructions on building the metajelo-ui code that don't use docker? |
@ajnsit I just added them to the README (make sure you are looking at the Also, I took the opportunity to move the 'app' folder contents to the repo root and update to purescript 0.13.3 |
Ah, i also added |
@ajnsit reading over #28 made me wonder if this could be an issue with how formless and react interact - does formless somehow need to keep track of its internal state and provide that as a I admit I'm not familiar enough with formless at the moment to really know where to begin looking; I'm working of purescript-concur-formless but maybe I should switch to formless-independent? I still see some Halogen imports, for instance. |
Hey @bbarker apologies for the late response. I finally got around to building your code and checking it out. I think you are right about it being the same problem as #28. The input will not retain its value unless you either explicitly handle it in Concur, OR use contactForm :: FState -> Widget HTML M.InstitutionContact
...
P.defaultValue $ F.getInput proxies.email1 fstate.form
... |
BTW, the reason why it works for |
@ajnsit excellent! I tried the I also tried playing around with menu :: ∀ opt s form e o restF restI inputs fields
. IsSymbol s
=> IsOption opt
=> BoundedEnum opt
=> Newtype (form Record F.FormField) (Record fields)
=> Cons s (F.FormField e opt o) restF fields
=> Newtype (form Variant F.InputFunction) (Variant inputs)
=> Cons s (F.InputFunction e opt o) restI inputs
=> form Record F.FormField
-> SProxy s
-> Widget HTML (F.Query form)
menu form field = D.select
[ P.defaultValue $ toOptionValue $ currentOpt form
, (F.set field <<< fromOptionValue <<< P.unsafeTargetValue) <$> P.onChange
]
(upFromIncluding (bottom :: opt) <#> \opt ->
D.option [
P.value (toOptionValue opt)
, P.selected $ isSelected opt (Just $ currentOpt form)
] [D.text (toOptionLabel opt)])
where
currentOpt form = F.getInput field form
isSelected :: ∀ opt. BoundedEnum opt => opt -> Maybe opt -> Boolean
isSelected opt (Just selOpt) = opt == selOpt
isSelected _ _ = false |
The contact type field seems to behave fine for me (i.e. does not get reset). Can you tell me the exact steps you are following? |
@ajnsit sure:
|
@ajnsit I see what you mean though - this is hard to reproduce! Without recompiling, I've been able to get both positive and negative results. Some observations (in addition to the above steps):
|
If it helps, there's now a live CI/CD demo at https://labordynamicsinstitute.github.io/metajelo-ui/ |
Just noting (mostly to myself) that this still is an issue on recent builds of metajelo-ui. |
Sorry for the barrage of signal questions/issues lately, but I'd say this is my most pressing concern so far.
I have the following outer signal and helper function:
The formless signals in this are
contactSignal
andpolicySigArray
;contactSignal
is simpler and is defined like this:However, whenever I enter text into a non-formless signal,
contactSignal
resets and becomesNothing
. All other signals (aside from other formless signals) maintain their values.An example of a signal that doesn't cause this issue is the
textInput
and derivativeurlInput
signals, also called fromaccumulateLocation
:The architecture of these signals seems to be much the same, except under the hood,
contactSignal
is using a concur-formless widget. Of course, Imay be missing something else important.Here is the complete code at this commit.
The text was updated successfully, but these errors were encountered: