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 InvestigationBuilder component initialization #8009

Closed
wants to merge 1 commit into from

Conversation

bodhish
Copy link
Member

@bodhish bodhish commented Jun 9, 2024

Related to #8008

Implements error handling and ensures data integrity in the InvestigationBuilder component to prevent TypeError: s.map is not a function.

  • Adds a try-catch block around the loadInvestigations async function to catch and log any errors that occur during the fetching of investigations and investigation groups. This prevents the application from crashing and logs the error for debugging purposes.
  • Initializes investigationsList as an empty array in the catch block of the loadInvestigations function if an error occurs during data fetching. This ensures that the .map() function can be safely called on investigationsList without causing a TypeError due to s.map is not a function.

For more details, open the Copilot Workspace session.

@bodhish bodhish requested a review from a team as a code owner June 9, 2024 18:19
Copy link

vercel bot commented Jun 9, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
care-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 9, 2024 6:21pm

Copy link

netlify bot commented Jun 9, 2024

Deploy Preview for care-egov-staging ready!

Name Link
🔨 Latest commit dd287f1
🔍 Latest deploy log https://app.netlify.com/sites/care-egov-staging/deploys/6665f23cf1868800084d77fe
😎 Deploy Preview https://deploy-preview-8009--care-egov-staging.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@bodhish
Copy link
Member Author

bodhish commented Jun 9, 2024

@gigincg can you review the PR?

Copy link

cypress bot commented Jun 9, 2024

Passing run #2728 ↗︎

0 124 0 0 Flakiness 0

Details:

Fix InvestigationBuilder component initialization
Project: CARE Commit: dd287f1985
Status: Passed Duration: 03:10 💡
Started: Jun 9, 2024 6:24 PM Ended: Jun 9, 2024 6:27 PM

Review all test suite changes for PR #8009 ↗︎

@bodhish bodhish requested a review from rithviknishad June 11, 2024 02:52
Copy link
Member

@rithviknishad rithviknishad left a comment

Choose a reason for hiding this comment

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

The error happens because the investigations prop passed to the component is set to {} instead of []. And hence cannot invoke .map on an object.

@bodhish bodhish deleted the bodhish/fix-investigation-builder branch December 1, 2024 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants