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: add default value when destructuring collaborator options #966

Merged
merged 5 commits into from
Aug 2, 2024

Conversation

zawan-ila
Copy link
Contributor

PROD-3229

Overview

It can happen that the collaborators have not been fetched before the page renders. This causes the collaborators to evaluate to undefined raising TypeErrors later when we try to use a .map on them

Copy link

codecov bot commented Aug 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 67.77%. Comparing base (ec03354) to head (0e9d149).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #966   +/-   ##
=======================================
  Coverage   67.76%   67.77%           
=======================================
  Files         128      128           
  Lines        3229     3230    +1     
  Branches      935      914   -21     
=======================================
+ Hits         2188     2189    +1     
- Misses        993      996    +3     
+ Partials       48       45    -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -268,7 +268,7 @@ export class BaseEditCourseForm extends React.Component {

const {
data: {
results: allResults,
results: allResults = [],
Copy link
Contributor

Choose a reason for hiding this comment

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

if the collaborators are not fetched, how will the retry occur if data is set to empty list here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Its just setting a default. Once the collaborators have been fetched, the state will update which will update the collaborator options with a "non-undefined" value for allResults and then that will be used by the code.

[PS] Note that the collaborator info is in collaboratorOptions, and this is just pulling information out of that object.

@zawan-ila zawan-ila merged commit b4d2b85 into openedx:master Aug 2, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants