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

TypeError: s.map is not a function in InvestigationBuilder component #8008

Closed
bodhish opened this issue Jun 9, 2024 · 5 comments · Fixed by ohcnetwork/care#2410
Closed
Assignees
Labels
good first issue Good for newcomers

Comments

@bodhish
Copy link
Member

bodhish commented Jun 9, 2024

An error was encountered in the InvestigationBuilder component causing the JavaScript TypeError: s.map is not a function. This error is likely due to attempting to call .map() on a variable s that is not properly initialized as an array before this method call.

Error Details

  • File: InvestigationBuilder.tsx
  • Function: InvestigationBuilder
  • Error Message: TypeError: s.map is not a function
  • Sentry Event ID: 3533b1853bd646609326b51cf152345a

Steps to Reproduce:

  1. Navigate to the URL: https://care.coronasafe.in/facility/0c95c7f0-e1d2-4aff-83fa-933cef60d3a8/patient/19adff46-588e-4072-89b3-a23ec1dec5fa/consultation/cc5ec4c3-94af-4fec-a954-fb9b7c45b89e/daily-rounds
  2. Error triggers when the component attempts to render based on fetched data that presumably includes an incorrectly formatted s variable.

Potential Cause:

The variable s might be either undefined or not an array at the time .map() is called. This could be due to a failure in data fetching or data transformation before passing it to the InvestigationBuilder.

Suggested Fix:

  • Ensure s is always initialized as an array.
  • Add error handling to check the type of s before applying array-specific methods like .map().

This issue has occurred in a staging environment, so it's crucial to address it before the next production deployment to prevent user-facing errors and potential disruptions in service.

Copy link

github-actions bot commented Jul 3, 2024

Hi, @coronasafe/care-frontend-maintainers, This issue has been automatically marked as stale because it has not had any recent activity.

@github-actions github-actions bot added the stale label Jul 3, 2024
@Yadavanurag13
Copy link

Yadavanurag13 commented Jul 24, 2024

@khavinshankar Hey, I would like to fix this issue. Please assign it to me.

@Yadavanurag13
Copy link

Yadavanurag13 commented Jul 24, 2024

I used the optional chaining method to avoid errors, but it ended up causing more issues.
?.map

"Could you please clarify if 'is s' is referring to investigations?"

@Yadavanurag13 Yadavanurag13 removed their assignment Jul 25, 2024
@github-actions github-actions bot removed the stale label Jul 28, 2024
Copy link

Hi, @coronasafe/care-frontend-maintainers, This issue has been automatically marked as stale because it has not had any recent activity.

@github-actions github-actions bot added the stale label Aug 14, 2024
@Nithin9585
Copy link
Contributor

hi @rithviknishad ,can you please assign this issue to me!.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

5 participants