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

Sitegen: Refactor Error State #530

Merged
merged 6 commits into from
Apr 8, 2024
Merged

Sitegen: Refactor Error State #530

merged 6 commits into from
Apr 8, 2024

Conversation

arunshenoy99
Copy link
Member

@arunshenoy99 arunshenoy99 commented Apr 1, 2024

Proposed changes

Type of Change

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)

Checklist

  • I have read the CONTRIBUTING doc
  • Linting and tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Further comments

This refactors the error state to make it more predictable, readable, and also fixes multiple bugs found within it.

  1. Rewrite the site meta generation logic to be more predictable.
  2. Avoid making step-specific API calls when in an error state.
  3. Remove circular dependencies by ensuring that we disable the error state only if it was enabled initially.
  4. Remove the error state on refresh: Sitegen: Add helper function for resetting error state wp-module-onboarding-data#66
  5. Utilize failure functions instead of directly modifying the state.

@arunshenoy99 arunshenoy99 added the Code Review The PR is in Code Review label Apr 1, 2024
Copy link
Member

@officiallygod officiallygod left a comment

Choose a reason for hiding this comment

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

Looks good!

@girish-lokapure
Copy link
Contributor

On the site-logo page, if you choose to skip the upload, all APIs are triggered twice.

This issue may occur because while on this step, the APIs are still pending, and if you skip the step, they are triggered again.

@arunshenoy99 arunshenoy99 added QA This PR is in QA and removed Code Review The PR is in Code Review labels Apr 5, 2024
@arunshenoy99
Copy link
Member Author

On the site-logo page, if you choose to skip the upload, all APIs are triggered twice.

This issue may occur because while on this step, the APIs are still pending, and if you skip the step, they are triggered again.

Fixed, thanks @girish-lokapure @ajayadav09. Please let me know if you find any more issues.


if ( response.body ) {
currentData.sitegen.homepages.data = response.body;
currentData.sitegen.siteGenMetaStatus.currentStatus += 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

Screenshot 2024-04-05 at 11 10 23 PM Screenshot 2024-04-05 at 11 24 52 PM

i failed the homepage API with mock error.
When the home page API fails in the background on the experience step and the user has selected one of the options from the survey question. The page doesn't move to the next step and the user is not aware of any errors, the user will be stuck on that step.

Copy link
Contributor

@ajayadav09 ajayadav09 left a comment

Choose a reason for hiding this comment

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

Looks good. It'll be good in case to show the error UI when the home page api fails on the experience step. Have added screenshot in the comments.

@arunshenoy99
Copy link
Member Author

Looks good. It'll be good in case to show the error UI when the home page api fails on the experience step. Have added screenshot in the comments.

Fixed, thanks @ajayadav09

@ajayadav09
Copy link
Contributor

Looks Good! Thanks @arunshenoy99

Copy link
Contributor

@ajayadav09 ajayadav09 left a comment

Choose a reason for hiding this comment

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

Tested the home page error status. Working as expected

@arunshenoy99 arunshenoy99 added Ready to merge The Code Review and QA is done and it can be merged. and removed QA This PR is in QA labels Apr 8, 2024
Copy link
Member

@officiallygod officiallygod left a comment

Choose a reason for hiding this comment

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

Looks Good!

@arunshenoy99 arunshenoy99 merged commit c1843b4 into trunk Apr 8, 2024
2 of 5 checks passed
@arunshenoy99 arunshenoy99 deleted the fix/error-state branch April 8, 2024 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ready to merge The Code Review and QA is done and it can be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants