Skip to content

Content Workspace: Load Data-Types based on Loaded Content Types#22886

Merged
madsrasmussen merged 3 commits into
release/17.4.1from
v17/hotfix/22877-data-type-load-race-condition
May 19, 2026
Merged

Content Workspace: Load Data-Types based on Loaded Content Types#22886
madsrasmussen merged 3 commits into
release/17.4.1from
v17/hotfix/22877-data-type-load-race-condition

Conversation

@nielslyngsoe
Copy link
Copy Markdown
Member

Ensures only the latest Data-Type request is used for Data-Type observation.
As well optimizes the load process, to first load Data-Types when all Content-Types(Compositions) are loaded.

Fixes #22877

Copilot AI review requested due to automatic review settings May 19, 2026 10:22
@claude
Copy link
Copy Markdown

claude Bot commented May 19, 2026

Claude encountered an error after 0s —— View job


I'll analyze this and get back to you.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to address a race condition behind the “saveAndPublish spinner loop” by changing how data-type details are loaded/observed: it defers bulk data-type loading until all composed content-types are loaded, and tries to ensure only the latest data-type request drives observation.

Changes:

  • Adjust content-type “loaded” detection to avoid triggering downstream work until content types/compositions are fully present.
  • Rework data-type-unique derivation and add a guard intended to ignore stale in-flight bulk requests when updating observed data-type details.
  • Export withLatestFrom via the backoffice RxJS re-export barrel.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/Umbraco.Web.UI.Client/src/packages/content/content-type/structure/content-type-structure-manager.class.ts Reworks when/how data-type uniques are emitted and adds bulk-load + stale-request guarding for data-type detail observation.
src/Umbraco.Web.UI.Client/src/external/rxjs/index.ts Re-exports withLatestFrom from RxJS for internal consumption.
Comments suppressed due to low confidence (1)

src/Umbraco.Web.UI.Client/src/packages/content/content-type/structure/content-type-structure-manager.class.ts:233

  • The bulk load path ignores { data, error } from requestByUniques and only updates #dataTypeDetails via asObservable(). If the detail store context isn’t available (or the bulk response is partial / errored), asObservable() can be undefined or emit an empty array, leaving contentTypeDataTypeDetailOf(...).asPromise() waiting forever. Handle error, and populate #dataTypeDetails from the returned data (and/or create placeholders for missing uniques) so callers can fail fast instead of hanging.
				if (dataTypeUniques && dataTypeUniques.length > 0) {
					const { asObservable } = await this.#dataTypeDetailRepository.requestByUniques(dataTypeUniques);
					// TODO: We should avoid this check, but architectural we are missing a way to cancel previous requests. [NL]
					// It is not very likely that this happens, but we keep this check to avoid eventual race conditions. [NL]
					const currentDataTypeUniques = this.getContentTypeDataTypeUniques();
					if (
						dataTypeUniques.length !== currentDataTypeUniques.length ||
						!dataTypeUniques.every((unique) => currentDataTypeUniques.includes(unique))
					) {
						return;
					}
					if (asObservable) {
						this.observe(
							asObservable(),
							(dataTypeDetails) => {
								this.#dataTypeDetails.setValue(dataTypeDetails ?? []);
							},

@nikolajlauridsen nikolajlauridsen deleted the branch release/17.4.1 May 19, 2026 10:32
@nielslyngsoe nielslyngsoe reopened this May 19, 2026
@claude
Copy link
Copy Markdown

claude Bot commented May 19, 2026

Claude encountered an error after 0s —— View job


I'll analyze this and get back to you.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@nielslyngsoe nielslyngsoe changed the title Load Data-Types based on Loaded Content Types Content Workspace: Load Data-Types based on Loaded Content Types May 19, 2026
@madsrasmussen madsrasmussen merged commit 426e516 into release/17.4.1 May 19, 2026
25 of 26 checks passed
@madsrasmussen madsrasmussen deleted the v17/hotfix/22877-data-type-load-race-condition branch May 19, 2026 13:02
@madsrasmussen madsrasmussen added release/17.4.1 category/performance Fixes for performance (generally cpu or memory) fixes type/bug labels May 19, 2026
AndyButland pushed a commit that referenced this pull request May 19, 2026
)

* Load Data-Types based on Loaded Content Types

* Update Comment

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* mergeObservables approach

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category/performance Fixes for performance (generally cpu or memory) fixes release/17.4.1 type/bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants