Skip to content

Conversation

@paula-stacho
Copy link
Collaborator

@paula-stacho paula-stacho commented Nov 6, 2024

Description

This one adds a LOADING_ERROR state. This state is reached whether the loading fails in the initial state (NOT_READY), or during polling (SHARDING). I have considered to simply show the toast during polling and continue with polling attempts. But seeing it in action, I think the toast isn't very clear when there was no user action, so I choose to handle both the same way (LOADING_ERROR and user has to reload). Let me know what you think about it, I'm on the edge about stopping the polling after it fails - it might be a temporary error after all.

Screenshot 2024-11-07 at 11 25 29

Checklist

Motivation and Context

  • Bugfix
  • New feature
  • Dependency update
  • Misc

Open Questions

Dependents

Types of changes

  • Backport Needed
  • Patch (non-breaking change which fixes an issue)
  • Minor (non-breaking change which adds functionality)
  • Major (fix or feature that would cause existing functionality to change)

@github-actions github-actions bot added the fix label Nov 6, 2024
@paula-stacho paula-stacho added the no release notes Fix or feature not for release notes label Nov 6, 2024
@paula-stacho paula-stacho marked this pull request as ready for review November 7, 2024 12:43
@djechlin-mongodb djechlin-mongodb self-requested a review November 7, 2024 14:41
Copy link
Collaborator

@gribnoysup gribnoysup left a comment

Choose a reason for hiding this comment

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

I have considered to simply show the toast during polling and continue with polling attempts

I think another option to consider here is that during polling we might just continue polling without notifications, logging errors should be enough for us to trace down the issue if users report something like "polling never ends". But also I think what you went with is also a good approach, constantly notifying with toasts also doesn't make much sense to me.

No strong preference though (generally probably would make sense to just stick with whatever mms is doing in these cases, or the closes approximation of it) so approved 👍

Comment on lines 96 to +100
failsOnShardingRequest?: never;
failsOnShardZoneRequest?: () => never;
failsToFetchClusterDetails?: never;
failsToFetchDeploymentStatus?: never;
failsToFetchShardKey?: () => boolean;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This special test api being a catch-all for all the tests in this file is getting a bit hard to read from my perspective, especially because it seems like most of these methods are added for just one test case. If you need a one-off mocking / stubbing for a special test case like that I would really recommend doing it right in your test:

it('fails when ...', function() {
  sinon.stub(atlasService, 'authenticatedFetch').rejects(...)
  // ... more of the test here
})

That way you're not binding your test to a shared mock implementation which usually makes tests easier to maintain in the long run and easier to understand what's being mocked when reading through the test case

Copy link
Collaborator Author

@paula-stacho paula-stacho Nov 8, 2024

Choose a reason for hiding this comment

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

I get your point, but in this case the tests were getting very verbose and difficult to read because 'authenticatedFetch' handles 4 different things. So often the tests were repeating the whole auth fetch mock logic section only to change 1 thing. The only one that would be easy to mock and only used once would be failsToFetchClusterDetails - because that is the very first request that happens in the flow, and it's only on init. That one I did just for consistency.

@paula-stacho paula-stacho merged commit 948c73f into main Nov 11, 2024
27 of 29 checks passed
@paula-stacho paula-stacho deleted the COMPASS-8446-2 branch November 11, 2024 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix no release notes Fix or feature not for release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants