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

[bugfix]: implement useWatch to see if changes occur in inputfield of form #2739

Merged

Conversation

SireeKoolenWijkstra
Copy link
Contributor

Implement useWatch
FormValues are not always updated because Detail is not always rendered anew. After 3 clicks a bug appears. Therefor implemented useWatch, so updates are monitored and only the effected component is rerendered

Signalen

Before opening a pull request, please ensure:

  • Make sure your PR title follows naming conventions: [feat-1234]: name feature
  • Double-check your branch is based on main and targets main
  • Pull request has tests (we are going for 100% coverage!)
  • Code is well-commented, linted and follows project conventions
  • Committed source code is headed by the correct SPDX license expression

Be kind to code reviewers, please try to keep pull requests as small and focused as possible :)

FormValues are not always updated because Detail is not always rendered anew. After 3 clicks a bug appears. Therefor implemented useWatch, so updates are monitored and only the effected component is rerendered
@SireeKoolenWijkstra SireeKoolenWijkstra marked this pull request as ready for review October 24, 2023 07:24
Copy link
Contributor

@vdegraaf vdegraaf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SireeKoolenWijkstra not sure what the bug is I should be testing. Is there a bug ticket? Or else a way to reproduce? Since I do not know where I should "click three times" and the bug appears.

image
If you uncheck and check the openbaar tonen checkbox a couple of times the Naam Openbaar (fieldgroup public_name) doesn't reappear. There is no bug ticket unfortunately.

Copy link
Contributor

@vdegraaf vdegraaf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix works! But you can do it with less code by just adding formMethods.watch('is_public_accessible') to the Detail component. Then it will trigger a rerender when that field changes.

Changed it. Thanks.

Copy link
Contributor

@vdegraaf vdegraaf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd expect just one line of code added. Why did you change all the rest?

Yo Vincent, to keep reactions and comments all in one place, also my reaction here. The code about the formValues need to be removed since that caused the bug. This was in commit 1. After your feedback I removed the code about the useWatch and replaced it with formMethods.watch('is_public_accessible'). So I do think that all the other code is also needed.

@SireeKoolenWijkstra SireeKoolenWijkstra merged commit 0007b1e into main Nov 7, 2023
9 checks passed
@SireeKoolenWijkstra SireeKoolenWijkstra deleted the bugfix-removing-formValues-implementing-useWatch branch November 7, 2023 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants