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 the issue that the initial values of the form on free listings editing page may be empty #2698

Merged
merged 1 commit into from
Nov 28, 2024

Conversation

eason9487
Copy link
Member

@eason9487 eason9487 commented Nov 28, 2024

Changes proposed in this Pull Request:

This PR fixes the issue that the initial values of the form on free listings editing page may be empty.

Root cause

Since the values fetched from the APIs are updated asynchronously via useEffect, there is a chance that the default empty array in the wp-data store may be passed as the initial values to the form. As a result, empty form fields may appear occasionally when editing free listings because the empty array can pass checks in SetupFreeListings.

The issue usually happens on the shipping time data because it's almost always the last to be fetched.

Kapture.2024-11-28.at.18.57.41.mp4

Detailed test instructions:

  1. Go to edit free listings
  2. Check if the saved shipping rates and times are shown on the form
  3. Refresh the webpage and check again
  4. Repeat steps 2-3 several times to see if the issue won't appear occasionally

Changelog entry

Fix - The initial values of the form on free listings editing page may be empty.

…Listings` being the default values of wp-data store.
@eason9487 eason9487 requested a review from a team November 28, 2024 11:08
@eason9487 eason9487 self-assigned this Nov 28, 2024
@github-actions github-actions bot added type: bug The issue is a confirmed bug. changelog: fix Took care of something that wasn't working. labels Nov 28, 2024
Copy link

codecov bot commented Nov 28, 2024

Codecov Report

Attention: Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.

Project coverage is 62.2%. Comparing base (16ff73f) to head (43b03e5).
Report is 2 commits behind head on develop.

Files with missing lines Patch % Lines
js/src/edit-free-campaign/index.js 0.0% 0 Missing and 4 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             develop   #2698      +/-   ##
============================================
- Coverage       65.1%   62.2%    -2.8%     
============================================
  Files            812     335     -477     
  Lines          24578    5147   -19431     
  Branches        1254    1256       +2     
============================================
- Hits           15990    3204   -12786     
+ Misses          8416    1769    -6647     
- Partials         172     174       +2     
Flag Coverage Δ
js-unit-tests 62.2% <0.0%> (-<0.1%) ⬇️
php-unit-tests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
js/src/edit-free-campaign/index.js 2.0% <0.0%> (-0.1%) ⬇️

... and 477 files with indirect coverage changes

Copy link
Contributor

@puntope puntope left a comment

Choose a reason for hiding this comment

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

Thanks @eason9487 for the quick fix. Works as expected for me. I refreshed several times. Like 10. And didn't happen.

@eason9487 eason9487 merged commit beac793 into develop Nov 28, 2024
9 checks passed
@eason9487 eason9487 deleted the fix/avoid-empty-edit-listings-form-values branch November 28, 2024 12:18
@puntope puntope mentioned this pull request Dec 3, 2024
22 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: fix Took care of something that wasn't working. type: bug The issue is a confirmed bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants