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

fix(client): fix json input component value handling #2028

Merged
merged 5 commits into from
Jun 11, 2023
Merged

fix(client): fix json input component value handling #2028

merged 5 commits into from
Jun 11, 2023

Conversation

mytharcher
Copy link
Contributor

@mytharcher mytharcher commented Jun 11, 2023

Description (Bug 描述)

JSON input component content not updated after new value from props.

Steps to reproduce (复现步骤)

  1. Use a json field in create form.
  2. Submit a record with some valid json data.
  3. Use data template in the form and select json field, also select the record just submitted.
  4. Create a new record and use data template from last submitted record.

Expected behavior (预期行为)

JSON field should be with the value from data template.

Actual behavior (实际行为)

Value is empty.

Related issues (相关 issue)

N/A.

Reason (原因)

JSONInput is not using value prop to react the changing value, due to legacy implementation for validation.

Solution (解决方案)

Use uncontrolled value controlling, with useState, useEffect, and only invoke onChange in onBlur phase.

@height
Copy link

height bot commented Jun 11, 2023

This pull request has been linked to 1 task:

💡Tip: Add "Close T-352" to the pull request title or description, to a commit message, or in a comment to mark this task as "Done" when the pull request is merged.

@mytharcher mytharcher merged commit dd9cb72 into main Jun 11, 2023
4 checks passed
@mytharcher mytharcher deleted the T-352 branch June 11, 2023 07:33
Dunqing pushed a commit that referenced this pull request Jun 12, 2023
* fix(client): fix json input component value handling

* fix(client): fix json input test case

* refactor(client): remove format button from json variable component

* refactor(client): move json input style to global

* test(client): remove unused test case
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant