Skip to content

fix(CLARK-CLIENT-1T): Prevent TypeError when collections are empty on user profile - #2281

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/clark-client-1t-empty-collections
Open

sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/clark-client-1t-empty-collections

Conversation

@sentry

@sentry sentry Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

This PR addresses issue CLARK-CLIENT-1T, a TypeError occurring on the user profile page (/users/:username/) when a user has no unreleased or released learning objects.

The root cause was identified as attempting to access [0].abvName on potentially empty collectionsUnreleased or collectionsReleased arrays without proper guards.

Changes made:

  • Added optional chaining (?.) to collectionsReleased[0].abvName in src/app/cube/user-profile/components/profile-learning-objects/profile-learning-objects.component.html (line 22) to prevent crashes when the 'Released Objects' tab is clicked and no released objects exist.
  • Added optional chaining (?.) to collectionsUnreleased[0].abvName in src/app/cube/user-profile/components/profile-learning-objects/profile-learning-objects.component.html (line 33) to prevent crashes when the 'Draft' tab is clicked and no unreleased objects exist.
  • Added optional chaining (?.) to collectionsReleased[0].abvName in src/app/cube/user-profile/components/profile-learning-objects/profile-learning-objects.component.ts (line 102) to prevent crashes during initial component load if no released objects are present.

These changes ensure that accessing abvName on an undefined object (resulting from [][0]) no longer throws a TypeError, making the user profile page more robust for users with empty collections.

Fixes CLARK-CLIENT-1T

This PR was automatically generated by Sentry. You can adjust this setting at any time.

This branch has not been deployed

No deployments
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.

0 participants