conform icon indicating copy to clipboard operation
conform copied to clipboard

Failure on strict-mode

Open artola opened this issue 9 months ago • 1 comments

Describe the bug and the expected behavior

Using reactStrictMode: true produces some failure (might be some effect not pure?) when using:

  const [meta, _form] = useField<string>(props.name!);
  const control = useInputControl(meta);

The same code works as expected with reactStrictMode: false. See example below.

Conform version

v1.2.2

Steps to Reproduce the Bug or Issue

In this sandbox, changing the reactStrictMode in the next.config.js between true and false leads to different situations. In the first, even when set an initial value for the field, this is not display as somehow get lost, and the form is invalid (can not be submitted). If we disable strict mode, then the field shows properly the default value and can be submitted.

https://codesandbox.io/p/devbox/pgh8pp

The expectation is that the value is properly shown independently of the setting chosen for strict mode.

What browsers are you seeing the problem on?

No response

Screenshots or Videos

Actual result with strict mode = true: Image

Actual result with strict mode = false: Image

Additional context

No response

artola avatar Mar 16 '25 12:03 artola

@edmundhung might be this problem related to the usage of MutationObserver which callback is executed async?

artola avatar Mar 17 '25 18:03 artola