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
Is your feature request related to a problem? Please describe.
This is question. I would like to know if a field/zodField atom inside listAtom is at index (say first or last).
Lets take an example
List> { A: fieldAtom, B: Atom}[]
If change of B atom is triggered, how do I know if its at n index of ListAtom
Describe the solution you'd like
I need to see the example if I am missing something.
Describe alternatives you've considered
I am using always listAtom validate to rely fully but that doest give inline error experience. In my case I would like to skip validation or make it optional.
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered:
Currently there is information about the item index in the list while you are rendering the list. The docs are full of this.
But I suspect that this question is related to the item position being unknown while you validate or change the data.
First of all, I would focus on the validation - previously I've added demo on the listAtom validation, where the ascending order of items is validated. I assume, that you would like to have this error attached to the specific items violating the ASC order, instead of having one error on the whole listAtom.
That looks like a valid feature request. But implementation wise, the validate function would need to be aware of the self fieldAtom, so it could retrieve its index from the list atom. The list atom is accessible, as the validate callback can read any atoms with the jotai get.
I can see this could be valuable, but implementation wise, to make the fields aware of context, that is more work. It would be similar to what I've implemented with the name atoms, which are recursive and support nested namespacing like users.0.accounts.2.iban.
That being said, if you really need this, you still can traverse your atoms in the validate config function of the listAtom and you can "forcibly" set the errorAtom of the respective fields. That would be imperative code.
Hello @MiroslavPetrik, Hope you are doing good !
Thanks alot for the reasoning and future forward to this library. I would like to contribute to this library in better way including future of whole form-atom org. Earlier I was not in state of understanding the granular details. Now I think I spent enough time with this and extend for advance usecases.
Any guidance for me would really appreciated!
Now, Coming back to this. I tried below snippet and it worked , see:
Is your feature request related to a problem? Please describe.
This is question. I would like to know if a field/zodField atom inside listAtom is at index (say first or last).
Lets take an example
List> { A: fieldAtom, B: Atom}[]
If change of B atom is triggered, how do I know if its at n index of ListAtom
Describe the solution you'd like
I need to see the example if I am missing something.
Describe alternatives you've considered
I am using always listAtom validate to rely fully but that doest give inline error experience. In my case I would like to skip validation or make it optional.
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: