--- tags: v3, blacksmiths, show and tell --- # v3 Show & Tell (7/29/22) ## FormBuilder Walkthrough - FormBuilder is now a Context that wraps React Hook Form -> `useFormBuilder` but can also use `FormBuilder` within something like the UI Library - Can access the methods and state of FormBuilder within the inputs - Injecting formState props such as disabled, errors via Context instead of on each Component - FieldLego uses a map type via keyof to the component and then can be accessed via the key, which turns it into partials instead of 1 big object - Seems to be looking for everything to match every case - In CoreFields: - Commenting out everything that isn't a text input resolves type errors but this is because this has the same props when being reconstituted ### Overview - Receives Layout and then maps the FormBuilderFactory and also has the rhf DevTools - Has the FormFooter - Building a form: - Can embed with layout items such as the labels, title, etc. - Can customize the validation for each field - Have an object with each field (look to FormLego) - Fields reference FieldLego[] type - Wraps RHF - FieldLego has validation -- can pass in the `expectType` - Validation is rules.ts which has a rules object - Form rules are being piped and woven together - RHF form rules are available - Handles the loading + submit flow as well - Direct improvement on the v2 Form Builder - How are we going to get DAO state into a Form Builder library (when we're autofilling with existing values) - Leverage defaultValues - get metadata from context -> fill in the defaultValues object ### Limitations - Can't find typesafe way to have ability to add app-specific or user-generated fields - Keep type safety for the standard ones but potentially sacrifice this for the custom ones in the short term - How could we derive the types for these custom fields? - CSInput -- wraps and incluedes a handlePlural so that we can minimize use of ternaries ## Ops Jam - Current PRs are failing builds - publish is broken for ui and daohaus-connect libraries aren't deploying to npm - `ngx deploy` is failing because it's not recognizing project in daohaus-connect and ui libraries - Producer PR has a migrate to nx 14 but that build is failing as there is an error at the last step of the build, but this may potentially fix it - migrating nx may fix this - nx report -- are there version mismatches? - these errors may have issues with the version of the library expecting and what the library is using - can try to overwrite the command with a run command that uses npm publish instead of a plugin - automatic versioning - added a CI build that checks if there is a new version - builds failing when not being manually bumped up ### Fixes - Issue is related to the vite packages as it's not happening on the non-vite packages - vite bundler for libaries (ui and daohaus-connect libraries) are impacted - https://github.com/vitejs/vite/issues/7484 - nx autoversioning plugin: https://github.com/jscutlery/semver - semver: - We'd do this on commits to master - Can we set this to only run on commits into master instead of develop? - It reads all commits - Can we do something that only has this run on master? - Would then go through affected projects and bump - Not reading the package.json versions -- it's reading the `git tag` that are created from the command - Once things are tagged it fits in with the public command to deploy the latest tags to npm -