zishh
zishh
SSolidJS
Created by zishh on 11/10/2023 in #support
Custom signal for observable props parameter - Reactivity issue
Got it working. Thank you!
5 replies
SSolidJS
Created by zishh on 11/10/2023 in #support
Custom signal for observable props parameter - Reactivity issue
Huh - I guess I have to read up on the API. I thought on is only necessary to make dependencies explicit. It is necessary here to get the previous value no?
5 replies
SSolidJS
Created by zishh on 11/10/2023 in #support
Custom signal for observable props parameter - Reactivity issue
@Toka Thanks that looks much better - Was not aware that I can put createEffect in the from creation. Issue with that code is that custom().unsubscribe(...) is not called. I guess it is only called onCleanup?
5 replies
SSolidJS
Created by zishh on 11/10/2023 in #support
Custom signal for observable props parameter - Reactivity issue
Ugly "solution" https://playground.solidjs.com/anonymous/40bc52e2-117d-4f4c-b755-da632491c92d I guess this is not the intended way?
5 replies
SSolidJS
Created by zishh on 9/12/2023 in #support
Best Practices for Unrepresentable Intermediate State
@maxoucsgo Hm i could also go the zod route and create a small library which automatically generates a relaxed model - I was not able to model the behavior I want with zod. Still think I am missing something completely.
32 replies
SSolidJS
Created by zishh on 9/12/2023 in #support
Best Practices for Unrepresentable Intermediate State
32 replies
SSolidJS
Created by zishh on 9/12/2023 in #support
Best Practices for Unrepresentable Intermediate State
Hey @maxoucsgo - I finally got some time to try it out. Unfortunately I did not get very far. If you still have time it would probably help me. How would you change this example and make it less ugly? It's basically the example from the beginning - Either both numbers are given or none.
32 replies
SSolidJS
Created by zishh on 9/12/2023 in #support
Best Practices for Unrepresentable Intermediate State
Do you mean that you or me create an example? I understood the Values type now. It's just an array of property-names + values tuples. I am not sure in what circumstances this is better than DeepPartial<Model> but its probably some kind of confusion on my side because I have not tried to implement this yet.
32 replies
SSolidJS
Created by zishh on 9/12/2023 in #support
Best Practices for Unrepresentable Intermediate State
Thanks for your help!
32 replies
SSolidJS
Created by zishh on 9/12/2023 in #support
Best Practices for Unrepresentable Intermediate State
I guess the issue is that I am usually not a web developer. So it is a bit hard to get a feeling - But yes I asked the question because the solutions I came up with looked ugly 🙂 I am not sure what this Values type would be. I guess I have to read up on typescript generics to decipher it.
32 replies
SSolidJS
Created by zishh on 9/12/2023 in #support
Best Practices for Unrepresentable Intermediate State
Okay - I will try this strategy and see how it goes. Regarding the second paragraph: Yes I have the case that b is actually optional in the model. So it is fine to completely leave it undefined. Its just that if I want to define it I have to fully define it.
32 replies
SSolidJS
Created by zishh on 9/12/2023 in #support
Best Practices for Unrepresentable Intermediate State
Hey thanks for your response. Do I understand your first approach correctly that you suggest to use Partial<T> for the current state of the form? If I think about it this is kind of the second model without all the boilerplate? It probably is the same as any other form validation - But I could not find a good article / blog post / whatever which describes validation from a design perspective.
32 replies
SSolidJS
Created by zishh on 4/10/2023 in #support
Constraining input element not working
Yes the undefined is the empty case. You example works for integer values but not if there is a fractional part. It gets more complicated with the latter because there are intermediate inputs which are not completely valid 123. is fine while inputting text but should become 123 when leaving focus. Better example: https://playground.solidjs.com/anonymous/3c92f707-e386-4778-a2a0-f97ea5e9029d But even with this example the behavior is weird because of the interaction with the signal. If the input value is 123.1 and the user removes the last character, the input becomes 123 instead of 123.. Thanks to the first answer in this thread I understand why this is the case but it is not ideal from a UX perspective.
13 replies
SSolidJS
Created by zishh on 4/10/2023 in #support
Constraining input element not working
Basically just a way to enter a number|undefined and prevent anything else from appearing in the input. Just to demonstrate the idea - Something like this: https://playground.solidjs.com/anonymous/683f3062-099c-46d8-b057-9f6501ba1c02 Requiring the consumer of the component to use { equals: false } doesn't sound very clean. And if the input state is 123 adding a . does not work because it is directly overwritten by the model value. I thought about implementing this as a directive instead - So the constraint handling does not happen on the signal. Does this make sense?
13 replies
SSolidJS
Created by zishh on 4/10/2023 in #support
Constraining input element not working
Thanks! Yes actually the substring was just an example. I want to constraint it to decimal values but the interaction is a bit confusing for me. I guess my issue before was that I tried to constraint the value set to the signal but not the actual input value. Actually I tried to use your library yesterday (edit: nvm it was another one) ! What confused me a bit was that my data model is number | undefined and removing the last character in the input resulted in a value of 0. I have found this behavior in the issue tracker of the project where someone (you?) mentioned to customize the mask implementation. But I could not wrap my head around it - Maybe I should check again. This seems such an easy task but somehow I am approaching it the wrong way.
13 replies
SSolidJS
Created by zishh on 4/10/2023 in #support
Constraining input element not working
Thanks this explains the behavior!
13 replies