Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #17758: V15 - Race condition breaks navigation between documents #17857

Open
wants to merge 4 commits into
base: v15/dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,9 @@ export class UmbContentTypeStructureManager<

async #loadContentTypeCompositions(ownerContentTypeCompositions: T['compositions'] | undefined) {
if (!ownerContentTypeCompositions) {
// Owner content type was undefined, so we can not load compositions. But at this point we neither offload existing compositions, this is most likely not a case that needs to be handled.
return;
// Owner content type was undefined, so we cannot load compositions.
// But to clean up existing compositions, we set the array to empty to still be able to execute the clean-up code.
ownerContentTypeCompositions = [];
}

const ownerUnique = this.getOwnerContentTypeUnique();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,10 @@
abstract readonly contentTypeUnique: Observable<string | undefined>;

/* Data Type */
// This dataTypeItemManager is used to load the data type items for this content type, so we have all data-types for this content type up front. [NL]
// But once we have a propert application cache this could be solved in a way where we ask the cache for the data type items. [NL]
// And then we do not need to store them here in a local manager, but instead just request them here up-front and then again needed(which would get them from the cache, which as well could be update while this runs) [NL]
readonly #dataTypeItemManager = new UmbDataTypeItemRepositoryManager(this);
/**
* Data Type Schema Map is used for lookup, this should make coder simpler and give better performance. [NL]
*/
#dataTypeSchemaAliasMap = new Map<string, string>();

#varies?: boolean;
#variesByCulture?: boolean;
Expand Down Expand Up @@ -236,19 +235,7 @@
this.#dataTypeItemManager.setUniques(dataTypeUniques);
},
null,
);

Check notice on line 238 in src/Umbraco.Web.UI.Client/src/packages/core/content/workspace/content-detail-workspace-base.ts

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (v15/dev)

✅ Getting better: Large Method

constructor decreases from 95 to 84 lines of code, threshold = 70. Large functions with many lines of code are generally harder to understand and lower the code health. Avoid adding more lines to this function.
this.observe(
this.#dataTypeItemManager.items,
(dataTypes) => {
// Make a map of the data type unique and editorAlias
this.#dataTypeSchemaAliasMap = new Map(
dataTypes.map((dataType) => {
return [dataType.unique, dataType.propertyEditorSchemaAlias];
}),
);
},
null,
);

this.loadLanguages();
}
Expand Down Expand Up @@ -426,7 +413,10 @@
throw new Error(`Property alias "${alias}" not found.`);
}

const editorAlias = this.#dataTypeSchemaAliasMap.get(property.dataType.unique);
// the getItemByUnique is a async method that first resolves once the item is loaded.
const editorAlias = (await this.#dataTypeItemManager.getItemByUnique(property.dataType.unique))
.propertyEditorSchemaAlias;
// This means if its not loaded this will never resolve and the error below will never happen.
if (!editorAlias) {
throw new Error(`Editor Alias of "${property.dataType.unique}" not found.`);
}
Expand Down
Loading