Comments (11)
Since React Compiler is still experimental, the bug have also been reported to React Compiler team, they replied it works as excepted and the library don't follow the React guidelines : facebook/react#29144
from react-hook-form.
The same applies to the formState.
export const useFieldError = () => {
const { fieldKey } = use(SchemaFieldContext);
const { errors } = useFormState({ name: fieldKey, exact: true });
return get(errors, fieldKey)?.message?.toString();
};
This hook fails to subscribe to changes when React Compiler is enabled. I had to add use no memo
for now.
from react-hook-form.
register
sometimes works, but sometimes refuses to track changes. The register()
call has to be called with use no memo
to work reliably.
Another hack for now:
const useRegisterProps = (name: string, props: RegisterOptions = {}) => {
'use no memo';
return useFormContext().register(name, props);
};
from react-hook-form.
const { watch } = useForm({ defaultValues: { customerId: "", addressId: "" } });
const customerId = useMemo(() => watch("customerId"), [watch]);
watch
reference is not going to change on each update unless we change the design (breaking change). almost need to remove this API just for the compiler. At this stage, consider using useWatch as a solution.
from react-hook-form.
Related Issues (20)
- issue: UseFormReturn Typescript Crash HOT 1
- issue: useForm reset issue when used with useSWR and conditional rendering HOT 2
- issue: useWatch / watch has wrong values when using form array with dnd kit HOT 4
- TTransformedValues should default to TFieldValues
- issue: react-hook-form bundle is different from other packages HOT 3
- Eslint plugin for react hook form HOT 1
- issue: Appending default values, such as 0 or an empty string, only allow a single element to be added when using useFieldArray
- issue: useWatch returning array with undefined HOT 1
- issue: Keep Dirty on reset does not work HOT 3
- issue: Form validation behavior changes when the isValid form state is subscribed HOT 4
- issue: Maximum Update Depth Exceeded error when using `isValidating` flag HOT 1
- issue: getFieldState().error type broken on nested FieldValues HOT 2
- issue: updating number values is always marked as dirty even if the value is the same as the default one HOT 4
- issue: appending/removing a field from field array marks all arrays as dirty
- issue: Field with useController inside useFieldArray not update HOT 3
- allow react 19 peer dependency
- issue: MALWARE ATTEMPT message HOT 3
- issue: register does not set the disabled prop when form is disabled HOT 1
- issue: cleanup process in `useController` crashes when used with `useFieldArray` in certain cases
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-hook-form.