Bug/CLARK-CLIENT-1G/fix-undefined-collection-access - #2275
Open
sentry[bot] wants to merge 1 commit into
Open
sentry[bot] wants to merge 1 commit into
sentry[bot] wants to merge 1 commit into
Conversation
This branch has not been deployed
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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
BuilderNavbarComponentattempts to access properties likecollection.nameandcollection.hasLogowithin an*ngIfcondition that only checks forlearningObject?.collection(which is a string ID). The actualcollectionobject is fetched asynchronously viagetCollection(). Due to a race condition, Angular's change detection can render the template before thecollectionobject is fully populated, leading to an attempt to read properties of anundefinedobject.Solution:
*ngIfcondition: Modified the*ngIfatsrc/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 thecollectionobject itself is defined, preventing premature access to its properties.?.) tocollection.nameandcollection.hasLogowithin the template as a defensive measure, although the updated*ngIflargely 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.