Skip to content

fix(sidebar): prevent null responses from sidebar API endpoints#974

Open
DHRUVI5674 wants to merge 1 commit intomattermost:masterfrom
DHRUVI5674:master
Open

fix(sidebar): prevent null responses from sidebar API endpoints#974
DHRUVI5674 wants to merge 1 commit intomattermost:masterfrom
DHRUVI5674:master

Conversation

@DHRUVI5674
Copy link

Fixes #235

Summary

Sidebar API endpoints sometimes returned null when GitHub API calls failed or returned unexpected data. This caused the Mattermost webapp sidebar to crash.

Changes

  • Return empty slices instead of nil in getUnreadsData
  • Ensure getSidebarData returns default SidebarContent on error
  • Added safety checks in sidebar API response
  • Improved JSON response handling to avoid null values

Testing

  • Tested locally with GitHub API failure simulation
  • Verified sidebar loads without crashing
  • Confirmed empty data shows correctly

Result

The sidebar no longer crashes when API endpoints return null or fail unexpectedly.

Type of change

  • Bug fix
  • New feature
  • Breaking change

@DHRUVI5674 DHRUVI5674 requested a review from a team as a code owner March 2, 2026 09:09
@mattermost-build
Copy link
Contributor

Hello @DHRUVI5674,

Thanks for your pull request! A Core Committer will review your pull request soon. For code contributions, you can learn more about the review process here.

Per the Mattermost Contribution Guide, we need to add you to the list of approved contributors for the Mattermost project.

Please help complete the Mattermost contribution license agreement?
Once you have signed the CLA, please comment with /check-cla and confirm that the CLA check is green.

This is a standard procedure for many open source projects.

Please let us know if you have any questions.

We are very happy to have you join our growing community! If you're not yet a member, please consider joining our Contributors community channel to meet other contributors and discuss new opportunities with the core team.

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.

Handle case where sidebar API endpoints return null

2 participants