Skip to content
Source
Sign inSign up
TanStack/form

[Feature Request]: Support preserving unrendered fields' values #417

Send to my agent
Closedcrutchcorn(GitHub profile, opens in a new tab) opened this issue 3 comments

This feature request comes from https://github.com/houseform/houseform/issues/45, the older form library I maintained

Description

Right now in, say, a multi-part form; you might have a series of fields you want to unrender but preserve their values.

Describe the solution you'd like

To support this usecase, we might want to introduce an API that looks something like:

<Field preserveValue={true}>

As well as a method for eventually deleting these fields should need-be:

formRef.current.deleteField("name");

Describe alternatives you've considered

It might also be nice to have a <Form initialValues={{name: ""}}> syntax to pre-emptively place values in non-rendered fields but this is likely overly challenging to implement and goes against our field-first API

  1. crutchcorn(GitHub profile, opens in a new tab) added labelstype: enhancement

  2. crutchcorn(GitHub profile, opens in a new tab) added labelsgood first issue

  3. can you assign this to me please @crutchcorn

  4. crutchcorn(GitHub profile, opens in a new tab) assignedvikaskumar89

  5. @crutchcorn What do you mean by un-rendered field? Does it mean when the field is unmounted or it's hidden from the DOM ?

  6. The two should ideally be one in the same. The field is unmounted when it's removed from the VDOM :) Happy to expand on this further if need be

Sign in to join this conversation.