Skip to content

feat: add useAppForm API to Vue #1455

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft

feat: add useAppForm API to Vue #1455

wants to merge 5 commits into from

Conversation

crutchcorn
Copy link
Member

TODOs:

  • Add docs

Copy link

nx-cloud bot commented Apr 25, 2025

View your CI Pipeline Execution ↗ for commit e2648fb

Command Status Duration Result
nx affected --targets=test:sherif,test:knip,tes... ❌ Failed 1m 24s View ↗
nx run-many --target=build --exclude=examples/** ✅ Succeeded 23s View ↗

☁️ Nx Cloud last updated this comment at 2025-07-05 11:42:37 UTC

Copy link

pkg-pr-new bot commented Apr 25, 2025

Copy link

codecov bot commented Apr 25, 2025

Codecov Report

Attention: Patch coverage is 71.87500% with 9 lines in your changes missing coverage. Please review.

Project coverage is 82.89%. Comparing base (daf8e57) to head (b170b68).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
packages/vue-form/src/createFormComposition.tsx 71.87% 8 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1455      +/-   ##
==========================================
- Coverage   88.83%   82.89%   -5.94%     
==========================================
  Files          31        3      -28     
  Lines        1379       76    -1303     
  Branches      347        3     -344     
==========================================
- Hits         1225       63    -1162     
+ Misses        137       12     -125     
+ Partials       17        1      -16     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@crutchcorn crutchcorn marked this pull request as draft April 25, 2025 14:20
@daniel100097
Copy link

Hi, I was just looking for a way to split a form in Vue (using TanStack Form) into separate fieldset components (using useAppForm).

Have you by any chance already found a way to pass the form context to a fieldset component in Vue? Or maybe a way to work with just a subset of the main form?

Specifically, I was trying to create a reusable fieldset for an address, so I could easily reuse it across different forms.

@crutchcorn
Copy link
Member Author

Unfortunately we're blocked by this ATM on Vue's side:

vuejs/core#8553

@daniel100097
Copy link

Even though it's not ideal with Vue, it might make sense to use the workaround for now — and once the Vue issue is resolved, we wouldn't need the workaround anymore.

I just tested it again with your StackBlitz example, and as soon as I write <component :is="compMap.one"/> , it seems to work.

    _createVNode($setup["SlotProvider"], null, {
      default: _withCtx(({ compMap }) => [
        (_openBlock(), _createBlock(_resolveDynamicComponent(compMap.one))),
        _cache[0] || (_cache[0] = _createElementVNode("p", null, "Despite it being a valid JS object and such:", -1 /* CACHED */)),
        _createElementVNode("p", null, _toDisplayString(JSON.stringify(compMap, null, 2)), 1 /* TEXT */)
      ]),
      _: 1 /* STABLE */,
      __: [0]
    })

@crutchcorn
Copy link
Member Author

No dice; Since we're in v1, introducing an API on our end requires docs, migration patterns, and more. I've considered allowing for <component :is> but don't want to have folks have to recant old code per a suggestion once Vue is updated.

The workaround for now - if you'd like to do that yourself until we launch - is to copy+paste the implementation of useAppForm and such into your codebase - shouldn't require any additional changes upstream.

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.

2 participants