Skip to content

[vue-form] Different behavior between SSR and SSG with form.Field wrapper #1395

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

Open
AlexPaven opened this issue Apr 8, 2025 · 1 comment

Comments

@AlexPaven
Copy link

Describe the bug

It's very likely this is due to some fundamental misunderstanding of mine, if that's the case I apologize.

In a nuxt app I tried wrapping form.Field in a component of my own, so I can provide some additional default functionality. Everything was fine in dev but I'm publishing my app using SSG, and there the form failed to render completely, saying "Cannot destructure property 'field' of 'undefined' as it is undefined."

I was finally able to find a workaround: in my component render form.Field dynamically using <component :is="form.Field" v-slot="{ field }"> and this seems to work fine; but it bugs me that I don't understand what the underlying issue is, and I would appreciate any pointers.

Perhaps this is a nuxt or vue issue but I have not been able to reproduce this with other components...

Your minimal, reproducible example

https://codesandbox.io/p/devbox/fancy-framework-hzpqyd

Steps to reproduce

The provided codesandbox reproduces the issue on startup; it is configured to run genserve which runs nuxt generate and then serve on the output. Running the dev configuration in there behaves fine.

I also tried to enable sourcemaps in nuxt.config.ts but the sourcemap for my component seems to be generated incorrectly; it shows the error happening somewhere in tanstack code.

Expected behavior

I would expect the same behavior in SSR and SSG

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

  • OS: Win11
  • Browser: Chrome 134
  • Node 20.18

TanStack Form adapter

vue-form

TanStack Form version

1.3.0

TypeScript version

No response

Additional context

No response

@teleskop150750
Copy link

teleskop150750 commented Apr 9, 2025

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

No branches or pull requests

2 participants