#32 Implements Retry on API call failure
Merged by lbrabec. Opened by manishakanyal.
fedora-qa/ manishakanyal/landingpage RetryOnFailureLoadData  into  master

Download 32.patch

Implements Retry on API call failure,
Alert on-screen when retrying,
Loaders when loading,
Retry button when auto-retry backs off/crosses a limit.
prettier config for better code readability throughout the codebase and better styling consistency.
Added Redux config for debugging in redux dev tools.

Fixes #7 #19 #33 and adds mentioned functionalities.
@lbrabec please let me know if any changes are needed.

Please add "jsxBracketSameLine: true", "semi: false" and "printWidth": 99 to the .prettierrc. I find it the most readable that way:

{
  "tabWidth": 2,
  "useTabs": false,
  "jsxBracketSameLine": true,
  "semi": false,
  "printWidth": 99,
}

retryLimit should be configurable or at least not hard coded on several places, please put it into config or into const somewhere else.

As I mentioned above, when you would change retryLimit, you'd have to change the number here. This is prone to errors...

I like the approach of doubling the time, maybe we could start with more than one second. With just one second the first two or three retries are too close to each other.

Metadata Update from @lbrabec:
- Pull-request tagged with: review in progress

@lbrabec, Great! I'll make the amendments and push the code.

1 new commit added

  • Moved retryLimit to Project Constants.

@lbrabec, I've pushed some changes. Can you have a look, please?

retryLimit in projectConstants.js looks good, thanks for adding additional rules to .prettierrc.

Please run prettier again on files you changed, so all the semicolons added in 42306e9 show alert when retrying and retry button on failure are removed.

Finally, please squash all the commits to one.

Thanks!

@lbrabec, Great, I'll do the needed and push the code.

rebased onto 9744f7fee896aa9baab79b41bb606575cdc9b428

@lbrabec, I have squashed the commits. Can you have a look, please?

Great, thanks!

Metadata Update from @lbrabec:
- Pull-request untagged with: review in progress
- Pull-request tagged with: review done

I don't believe we need this method. Passing this through Layout to Masthead introduces unnecessary clutter. You can use connect() to have access to this.props.dispatch() in Masthead directly.

Metadata Update from @lbrabec:
- Pull-request untagged with: review done
- Pull-request tagged with: review in progress

same here

This also applies to checking api_call_status, you can access it directly when using connect(), no need to explicitly pass it down through several components.

Hi @lbrabec, there are two api_call_status, one in wizard_page while another one is in landing_page.
That's why I passed the value of api_call_status using props.

To avoid this nesting, we may pass some id in Layout -> Masthead and then decide which api_call_status to take from the global state.

What about using withRouter (docs) or rewriting Masthead to functional component and use hook useLocation (docs). That way you won't have to pass anything and Masthead itself will know which api_call_status to use based on data in this.props.location.

Other option is to just have one api_call_status in global state that is general and not specific to particular endpoint. But I guess you have a reason to have two api_call_status.

1 new commit added

  • Masthead implementation change

@lbrabec, I have pushed the changes, can you have a look?

Looks good! I tested the retry feature and it works.

Please, squash commits to one and rebase onto current master. I'll then merge this PR.

Metadata Update from @lbrabec:
- Pull-request untagged with: review in progress
- Pull-request tagged with: review done

rebased onto 70cedc9fcddc9e7b7b0923573ead580f73184616

That sounds great!
@lbrabec, I have squashed the commits, please have a look.

rebased onto 27e3d14acab32e477ce3c2c09887fe8fb6d8fdbe

Pull-Request has been merged by lbrabec

Metadata