Skip to content

Conversation

@kevinherdez
Copy link
Collaborator

This PR is based off a comment made in the original work to add images to avalanche observations

This refactors the AvalancheImagePicker and ObservationImagePicker into a new ImageCaptionField

I tried to make it as generic as possible by following what was done in TextField.tsx, but what I didn't know is that that only works when the form field value is not a collection. I was having a hard time figuring out how to strongly type the expected array value while keeping it a generic.

In the end, I decided to rely on the fact that this component is always used in a FormProvider so useController can infer the value types for the form data without having to strongly type it like TextField does. This works, but you lose the compiler throwing an error if the name property does not map to an array of image assets like how TextField will error if name does not map to a string.

@kevinherdez kevinherdez linked an issue Jan 22, 2026 that may be closed by this pull request
@stevekuznetsov stevekuznetsov added this pull request to the merge queue Jan 22, 2026
Merged via the queue into NWACus:main with commit 7b411c5 Jan 22, 2026
5 checks passed
@kevinherdez kevinherdez deleted the kevinherdez/refactorAvalancheImagePicker branch January 23, 2026 23:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor AvalancheImagePicker and ObservationImagePicker

2 participants