Skip to content

fix: Guard Object.assign against null/undefined resourceUris (CLARK-CLIENT-Q) - #2286

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/clark-client-q-object-assign-guard
Open

sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/clark-client-q-object-assign-guard

Conversation

@sentry

@sentry sentry Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

This PR addresses TypeError: Object.assign requires that input parameter not be null or undefined (CLARK-CLIENT-Q) occurring in /onion/dashboard/.

Root Cause:
The error occurred in src/app/core/learning-object-module/learning-object/learning-object.service.ts around line 145. When a learning object was malformed (e.g., after a 404 response from POST /learning-objects//bundle due to an empty object ID), entity.resourceUris would be undefined. The subsequent call to Object.assign(entity.resourceUris) would then throw a TypeError because Object.assign was called with null or undefined as its first argument, and there was no guard to prevent this.

Changes Made:

  1. Added undefined guard: The code block responsible for iterating and fetching resource URIs (lines 145-164) is now wrapped in an if (entity.resourceUris !== undefined) condition. This prevents Object.assign from being called with an undefined value and skips resource fetching for malformed learning objects.
  2. Corrected Object.assign usage: Changed Object.assign(entity.resourceUris) to Object.assign({}, entity.resourceUris) to ensure a proper shallow clone of the resourceUris object is created, aligning with the likely original intent.

These changes are consistent with existing null/undefined handling patterns found elsewhere in the same file (e.g., lines 235-243).

Fixes CLARK-CLIENT-Q

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

curlyLasagna added a commit that referenced this pull request Sep 15, 2026
* Bug/CLARK-CLIENT-2B/fix-typeerror-empty-collections (#2294)

* Bug/CLARK-CLIENT-2D/fix-typeerror-clark-message-render (#2293)

* Bug/CLARK-CLIENT-22/fix-typeerror-tags-undefined (#2292)

* fix: CLARK-CLIENT-1E - Prevent TypeError on dashboard learning object list (#2291)

* fix(CLARK-CLIENT-1D): Prevent Sentry reports for handled file name validation errors (#2290)

* Bug/CLARK-CLIENT-1/fix expression changed after checked error (#2288)

* Bug/CLARK-CLIENT-16/fix-children-filter-typeerror (#2287)

* fix: Guard Object.assign against null/undefined resourceUris (CLARK-CLIENT-Q) (#2286)

* fix: CLARK-CLIENT-20 Guard against null #header element in setColorScheme (#2285)

* fix: CLARK-CLIENT-1Z - Prevent TypeError on collection description (#2284)

* Bug/CLARK-CLIENT-1Y/fix-context-menu-focus-error (#2283)

* Bug/CLARK-CLIENT-1R/fix-undefined-length-error (#2282)

* fix: Prevent TypeError when skip link target is null (#2280)

* Bug/CLARK-CLIENT-1M/fix-undefined-id-error (#2279)

* Bug/CLARK-CLIENT-1K/fix-undefined-collection-access (#2278)

* Bug/CLARK-CLIENT-1N/fix-trap-focus-null-relatedtarget (#2277)

* Bug/CLARK-CLIENT-1A/fix-undefined-learningobject-access (#2274)

* fix(CLARK-CLIENT-1B): Prevent TypeError when mouse leaves viewport in context menu (#2271)

* Bug/CLARK-CLIENT-6/fix-typeerror-change-password (#2270)

* Bug/CLARK-CLIENT-17/fix-unauthorized-component-auth-injection (#2269)

* Bug/CLARK-CLIENT-Z/fix-typeerror-in-register-username-validation (#2263)

* Bug/CLARK-CLIENT-5/fix-expression-changed-error (#2262)

* Bug/CLARK-CLIENT-10/fix-null-author-typeerror (#2261)

* Bug/CLARK-CLIENT-P/add-optional-chaining-for-auth-user (#2258)

* Bug/CLARK-CLIENT-T/fix-undefined-description (#2257)

* Bug/CLARK-CLIENT-J/fix-materials-component-typeerror (#2252)

* fix da linter

* Allow local development to load due to 9ca2a37 (“fix expression changed error”)

---------

Co-authored-by: Joaquin Villagomez <joaquinvillagomez@Joaquins-MacBook-Air.local>
Co-authored-by: Luis <luis.gcodes@gmail.com>

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