Skip to content
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

Blitz generate should provide functioning forms for a better scaffolding experience. #4281

Open
ReadB opened this issue Jan 15, 2024 · 2 comments
Labels
good first issue Good for newcomers status/ready-to-work-on This issue is up for grabs

Comments

@ReadB
Copy link

ReadB commented Jan 15, 2024

What do you want and why?

There are some bugs here as well but I feel the generate command needs some attention. At the moment blitz generate all will only provide forms with a LabeledTextField component that works with the string, uuid, json?, and datetime types.

When creating a new app and using the generate command to scaffold an idea, it would be great to have a functioning app without modifying any code.

Without any modifications after generating, the following errors occur:

  • With int, number, bigint, float, decimal, the form says: Expected number, received string.

  • WIth boolean, the form says: Expected boolean, received string.

  • With belongsTo:model, the page fails to compile with error Module not found: Can't resolve 'src/core/components/LabelSelectField'. And an additional error since v2.0.2, in the usePaginatedQuery it uses a get query but uses the /src/model/ directory instead of the new /src/app/model/ directory.

  • With datetime, it works with the string type if a full ISO 8601 datetime is used. However, this only works after modifying the CreateSchema as there is an extra function call and produces the error TypeError: zod__WEBPACK_IMPORTED_MODULE_0__.z.string(...).datetime(...) is not a function

Possible implementation(s)

I'm suggesting a better defaultCodegenConfig with more starter components. This could include:

  • working number input
  • date picker for datetime
  • simple checkbox input for boolean
  • select with options for selecting a parent model
  • cloned form for creating a child while creating a parent
@siddhsuresh
Copy link
Member

@ReadB would you be willing to make a PR for this?

@siddhsuresh siddhsuresh added good first issue Good for newcomers status/ready-to-work-on This issue is up for grabs labels Jan 16, 2024
@tordans
Copy link
Contributor

tordans commented Jan 16, 2024

It would be great to have a best practice generated by the scaffolding to handle boolean fields and fields of type number. In both cases, I struggle with when to transform the data to string … and when to transform it back … and how to create nice Zod schemas / TS for both.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers status/ready-to-work-on This issue is up for grabs
Projects
None yet
Development

No branches or pull requests

4 participants