Skip to content
Source
Sign inSign up
TanStack/form

feat: added ability to specify values for `form.reset` method #791

Mergedvara855(GitHub profile, opens in a new tab)merged 6 commits intomain fromrefs/pull/791/headmerged by Balastrong(GitHub profile, opens in a new tab)

    1. This would be nice!

      Any ideas when this would be merged?

    2. Thanks for the PR, looks like a great starting point! Let me add a thought, this seems to me more like a setAll than a proper reset, which I would expect also setting the new default values.

      Doing this (in two separate moments):

      reset({ firstName: "foo" }) // Passing an object - set the new default
      reset() // No parameters - reset to default

      Should end up with the form this the state { firstName: "foo" }. At least as a default behaviour, then nothing stops us from adding an extra parameter with a flags, similar to RHF, to control that.

      What do you think?

    3. a functionality like this would be pretty helpful.

    4. ☁️ Nx Cloud Report

      CI is running/has finished running commands for commit 5a66fd216a6f982d6236a69e0ecc4562f510a959. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

      📂 See all runs for this CI Pipeline Execution


      ✅ Successfully ran 2 targets

    5. Sent with 💌 from NxCloud.

  • Open in Stackblitz

    More templates

    @tanstack/angular-form

    pnpm add https://pkg.pr.new/@tanstack/angular-form@791

    @tanstack/lit-form

    pnpm add https://pkg.pr.new/@tanstack/lit-form@791

    @tanstack/form-core

    pnpm add https://pkg.pr.new/@tanstack/form-core@791

    @tanstack/react-form

    pnpm add https://pkg.pr.new/@tanstack/react-form@791

    @tanstack/solid-form

    pnpm add https://pkg.pr.new/@tanstack/solid-form@791

    @tanstack/valibot-form-adapter

    pnpm add https://pkg.pr.new/@tanstack/valibot-form-adapter@791

    @tanstack/vue-form

    pnpm add https://pkg.pr.new/@tanstack/vue-form@791

    @tanstack/yup-form-adapter

    pnpm add https://pkg.pr.new/@tanstack/yup-form-adapter@791

    @tanstack/zod-form-adapter

    pnpm add https://pkg.pr.new/@tanstack/zod-form-adapter@791

    commit: 5a66fd2

  • Codecov Report

    Attention: Patch coverage is 83.33333% with 1 line in your changes missing coverage. Please review.

    Project coverage is 88.45%. Comparing base (5473bb8) to head (5a66fd2). Report is 158 commits behind head on main.

    Files with missing linesPatch %Lines
    packages/form-core/src/FormApi.ts83.33%1 Missing :warning:
    Additional details and impacted files
    @@            Coverage Diff             @@
    ##             main     #791      +/-   ##
    ==========================================
    - Coverage   91.55%   88.45%   -3.10%     
    ==========================================
      Files          21       26       +5     
      Lines         900     1083     +183     
      Branches      206      269      +63     
    ==========================================
    + Hits          824      958     +134     
    - Misses         71      116      +45     
    - Partials        5        9       +4     

    :umbrella: View full report in Codecov by Sentry. :loudspeaker: Have feedback on the report? Share it here.

  • Sign in to join this conversation.