Skip to content

Bug/CLARK-CLIENT-1G/fix-undefined-collection-access - #2275

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/bug/clark-client-1g/fix-undefined-collection-access
Open

sentry[bot] wants to merge 1 commit into
mainfrom
seer/bug/clark-client-1g/fix-undefined-collection-access

Conversation

@sentry

@sentry sentry Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

This PR addresses TypeError: Cannot read properties of undefined (reading 'name') (CLARK-CLIENT-1G) occurring in the Learning Object Builder navbar.

Root Cause:
The template in BuilderNavbarComponent attempts to access properties like collection.name and collection.hasLogo within an *ngIf condition that only checks for learningObject?.collection (which is a string ID). The actual collection object is fetched asynchronously via getCollection(). Due to a race condition, Angular's change detection can render the template before the collection object is fully populated, leading to an attempt to read properties of an undefined object.

Solution:

  1. Updated *ngIf condition: Modified the *ngIf at src/app/onion/learning-object-builder/components/builder-navbar/builder-navbar.component.html (lines 35-39) to include && collection. This ensures the block only renders when the collection object itself is defined, preventing premature access to its properties.
  2. Added safe navigation: Applied safe navigation (?.) to collection.name and collection.hasLogo within the template as a defensive measure, although the updated *ngIf largely mitigates the direct need for it.

Fixes CLARK-CLIENT-1G

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