fix(repos): Filter null integrations in useScmIntegrationTreeData#110868
Merged
fix(repos): Filter null integrations in useScmIntegrationTreeData#110868
Conversation
bd904c8 to
8904e88
Compare
ryan953
commented
Mar 17, 2026
| () => (integrationsQuery.data ?? []).filter(i => scmProviderKeys.has(i.provider.key)), | ||
| () => | ||
| integrationsQuery.data?.filter( | ||
| i => i !== null && scmProviderKeys.has(i.provider.key) |
Member
Author
There was a problem hiding this comment.
guard against the null case. the types don't support it though.
related to #110865
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix prepared fixes for both issues found in the latest run.
- ✅ Fixed: Removing
?? []makesscmIntegrationscrash on.map()- Restored the
?? []fallback to ensure scmIntegrations is always an array, preventing TypeError when .map() is called during query loading.
- Restored the
- ✅ Fixed: Removing
?? []makesscmProviderspotentially undefined- Restored the
?? []fallback to ensure scmProviders is always an array, preventing TypeError when accessing .length or .map() during query loading.
- Restored the
Or push these changes by commenting:
@cursor push 5d1b5bde67
Preview (5d1b5bde67)
diff --git a/static/app/components/repositories/scmIntegrationTree/useScmIntegrationTreeData.ts b/static/app/components/repositories/scmIntegrationTree/useScmIntegrationTreeData.ts
--- a/static/app/components/repositories/scmIntegrationTree/useScmIntegrationTreeData.ts
+++ b/static/app/components/repositories/scmIntegrationTree/useScmIntegrationTreeData.ts
@@ -40,8 +40,8 @@
const scmProviders = useMemo(
() =>
- providersQuery.data?.providers
- ?.filter(p => p.metadata.features.some(f => f.featureGate.includes('commits')))
+ (providersQuery.data?.providers ?? [])
+ .filter(p => p.metadata.features.some(f => f.featureGate.includes('commits')))
.sort((a, b) => a.name.localeCompare(b.name)),
[providersQuery.data]
);
@@ -61,7 +61,7 @@
const scmIntegrations = useMemo(
() =>
- integrationsQuery.data?.filter(
+ (integrationsQuery.data ?? []).filter(
i => i !== null && scmProviderKeys.has(i.provider.key)
),
[integrationsQuery.data, scmProviderKeys]This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.
8904e88 to
d8f0e77
Compare
The /integrations/ API can return null items in the list when the backend serializer fails for an integration. Accessing .provider.key on null causes a TypeError that crashes the settings/repos/ page with an error boundary. Guard the filter to skip null items. Fixes JAVASCRIPT-381Y Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
d8f0e77 to
6479deb
Compare
scttcper
reviewed
Mar 17, 2026
Comment on lines
+10
to
+47
| const githubProvider = { | ||
| key: 'github', | ||
| slug: 'github', | ||
| name: 'GitHub', | ||
| canAdd: true, | ||
| canDisable: false, | ||
| features: ['commits'], | ||
| metadata: { | ||
| aspects: {}, | ||
| author: 'The Sentry Team', | ||
| description: '', | ||
| features: [{featureId: 1, featureGate: 'integrations-commits', description: ''}], | ||
| issue_url: '', | ||
| noun: 'Installation', | ||
| source_url: '', | ||
| }, | ||
| setupDialog: {height: 600, url: '', width: 600}, | ||
| }; | ||
|
|
||
| const githubIntegration = { | ||
| id: '1', | ||
| name: 'GitHub', | ||
| provider: { | ||
| key: 'github', | ||
| slug: 'github', | ||
| name: 'GitHub', | ||
| canAdd: true, | ||
| canDisable: false, | ||
| features: [], | ||
| aspects: {}, | ||
| }, | ||
| domainName: 'github.com/test', | ||
| icon: null, | ||
| accountType: null, | ||
| gracePeriodEnd: null, | ||
| organizationIntegrationStatus: 'active', | ||
| status: 'active', | ||
| }; |
Member
There was a problem hiding this comment.
do we have types or fixtures for these
scttcper
approved these changes
Mar 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


The
/integrations/API can returnnullitems in the response list when the backend serializer fails for an individual integration (the backend fix for that is in #110865). Thefiltercall inuseScmIntegrationTreeDatawas accessingi.provider.keywithout guarding against null items, causing aTypeErrorthat crashed the/settings/repos/page behind an error boundary.Add a
i !== nullguard before accessing.provider.key.Related to #110865
Fixes JAVASCRIPT-381Y