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

Bug 1907863: Update quick start actions to handle concurrent state updates #7553

Merged

Conversation

rohitkrai03
Copy link
Contributor

Fixes: https://issues.redhat.com/browse/ODC-5233
Fixes: https://issues.redhat.com/browse/ODC-5236
Fixes: https://issues.redhat.com/browse/ODC-5268

Analysis / Root cause: While moving from local storage to use settings the quick start state was moved from redux to top level context using context provider extension. The quick start state is very complex and require concurrent update to the state for each user action, that is why there were multiple calls to setState((state) => newState) which resulted in each call working with the older and stale state. this resulted in none of the quick start actions working correctly.

Solution Description: There were two possible solutions for the above problem -

  1. Use redux or useReducer for managing state of quick start. The problem with this approach is that the initialState of the reducer needs to be async coming from user settings. One way to solve this was to have a separate action just to initialize the state asynchronously but not sure if this is a widely accepted pattern for doing such things.
  2. Convert existing state update callbacks to mimic user actions and handle all concurrent updates together.

Went ahead with the second approach for now as that required less changes to the current code.

Screen shots / Gifs for design review:

Quick Start Fix

Browser conformance:

  • Chrome
  • Firefox
  • Safari
  • Edge

@openshift-ci-robot openshift-ci-robot added component/core Related to console core functionality approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Dec 15, 2020
@rohitkrai03
Copy link
Contributor Author

/cc @sahil143 @invincibleJai

@rohitkrai03 rohitkrai03 changed the title Update quick start actions to handle concurrent state updates Bug 1907863: Update quick start actions to handle concurrent state updates Dec 15, 2020
@openshift-ci-robot
Copy link
Contributor

@rohitkrai03: This pull request references Bugzilla bug 1907863, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.7.0) matches configured target release for branch (4.7.0)
  • bug is in the state NEW, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

Bug 1907863: Update quick start actions to handle concurrent state updates

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci-robot openshift-ci-robot added bugzilla/severity-medium Referenced Bugzilla bug's severity is medium for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. labels Dec 15, 2020
Copy link
Contributor

@sahil143 sahil143 left a comment

Choose a reason for hiding this comment

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

@rohitkrai03 can we add the sync true to AllQuickStartStates only. This will be helpful if the Quickstarts are open in two different browser tabs.

@rohitkrai03
Copy link
Contributor Author

@sahil143 Added sync true for all quick start states.

Copy link
Contributor

@sahil143 sahil143 left a comment

Choose a reason for hiding this comment

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

The back button on the quick start is not working
quickstart-back

@rohitkrai03
Copy link
Contributor Author

The back button on the quick start is not working
quickstart-back

@sahil143 Fixed.

@sahil143
Copy link
Contributor

@rohitkrai03 I'm seeing a weird mismatch in the state. Not sure if it's to do with quick start state updates or the userSettings hook itself
The state is correct on the card(completed) in both tabs but once it is opened the state changes to InProgress
quick-start-tour

@rohitkrai03
Copy link
Contributor Author

@rohitkrai03 I'm seeing a weird mismatch in the state. Not sure if it's to do with quick start state updates or the userSettings hook itself
The state is correct on the card(completed) in both tabs but once it is opened the state changes to InProgress
quick-start-tour

That's actually because Start the tour button sets the status to In progress as well. I think if user starts a completed tour again, the status should be updated to In progress. We can confirm this behaviour with UX if needed.

@sahil143
Copy link
Contributor

That's actually because Start the tour button sets the status to In progress as well. I think if user starts a completed tour again, the status should be updated to In progress. We can confirm this behaviour with UX if needed.

Ah Okay! That makes sense

Copy link
Contributor

@sahil143 sahil143 left a comment

Choose a reason for hiding this comment

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

/lgtm

verified changes locally. works as expected

@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rohitkrai03, sahil143

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Dec 17, 2020
@rohitkrai03
Copy link
Contributor Author

/retest

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@rohitkrai03
Copy link
Contributor Author

/retest

@openshift-merge-robot openshift-merge-robot merged commit 9fa0f7a into openshift:master Dec 17, 2020
@openshift-ci-robot
Copy link
Contributor

@rohitkrai03: All pull requests linked via external trackers have merged:

Bugzilla bug 1907863 has been moved to the MODIFIED state.

In response to this:

Bug 1907863: Update quick start actions to handle concurrent state updates

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@spadgett spadgett added this to the v4.7 milestone Jan 7, 2021
@rohitkrai03 rohitkrai03 deleted the quick-start-reducer-fix branch July 24, 2021 06:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. bugzilla/severity-medium Referenced Bugzilla bug's severity is medium for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. component/core Related to console core functionality lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants