diff --git a/src/Umbraco.Web.UI.Client/.vscode/settings.json b/src/Umbraco.Web.UI.Client/.vscode/settings.json index d03517a13e..26b5d4b347 100644 --- a/src/Umbraco.Web.UI.Client/.vscode/settings.json +++ b/src/Umbraco.Web.UI.Client/.vscode/settings.json @@ -5,6 +5,7 @@ "Backoffice", "combobox", "Elementable", + "Niels", "pickable", "templating", "umbraco", diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/variant/variant-id.class.ts b/src/Umbraco.Web.UI.Client/src/packages/core/variant/variant-id.class.ts index d8e07d72d0..591731aa49 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/variant/variant-id.class.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/variant/variant-id.class.ts @@ -7,12 +7,12 @@ export class UmbVariantId { public readonly segment: string | null = null; constructor(variantData: { culture?: string | null; segment?: string | null }) { - this.culture = variantData.culture || null; - this.segment = variantData.segment || null; + this.culture = (variantData.culture === 'invariant' ? null : variantData.culture) ?? null; + this.segment = variantData.segment ?? null; } public compare(obj: { culture?: string | null; segment?: string | null }): boolean { - return this.culture === (obj.culture || null) && this.segment === (obj.segment || null); + return this.equal(new UmbVariantId(obj)); } public equal(variantId: UmbVariantId): boolean { diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/workspace/workspace-variant/workspace-variant.context.ts b/src/Umbraco.Web.UI.Client/src/packages/core/workspace/workspace-variant/workspace-variant.context.ts index 34d3e9329c..216dd225ed 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/workspace/workspace-variant/workspace-variant.context.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/workspace/workspace-variant/workspace-variant.context.ts @@ -53,7 +53,7 @@ export class UmbWorkspaceVariantContext { this._observeVariant(); }); - this.index.subscribe(() => { + new UmbObserverController(host, this.#index, () => { this._observeVariant(); }); } diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/repository/document.repository.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/repository/document.repository.ts index fb3d32ce43..9ccd7feb2c 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/repository/document.repository.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/repository/document.repository.ts @@ -164,17 +164,18 @@ export class UmbDocumentRepository const { error } = await this.#detailDataSource.insert(item); if (!error) { + // TODO: we currently don't use the detail store for anything. + // Consider to look up the data before fetching from the server + this.#store?.append(item); + // TODO: Update tree store with the new item? or ask tree to request the new item? + + // TODO: Revisit this call, as we should be able to update tree on client. + await this.requestRootTreeItems(); + const notification = { data: { message: `Document created` } }; this.#notificationContext?.peek('positive', notification); } - const result = await this.requestRootTreeItems(); - console.log("requested root tree items", result); - - // TODO: we currently don't use the detail store for anything. - // Consider to look up the data before fetching from the server - this.#store?.append(item); - // TODO: Update tree store with the new item? or ask tree to request the new item? return { error }; } @@ -195,6 +196,9 @@ export class UmbDocumentRepository //this.#treeStore?.updateItem(item.id, { name: item.name });// Port data to tree store. // TODO: would be nice to align the stores on methods/methodNames. + // TODO: Revisit this call, as we should be able to update tree on client. + await this.requestRootTreeItems(); + const notification = { data: { message: `Document saved` } }; this.#notificationContext?.peek('positive', notification); } diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/workspace/document-workspace.context.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/workspace/document-workspace.context.ts index b6ac678d65..c018ce9685 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/workspace/document-workspace.context.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/workspace/document-workspace.context.ts @@ -118,12 +118,14 @@ export class UmbDocumentWorkspaceContext } setName(name: string, variantId?: UmbVariantId) { + console.log("setname", name, variantId) const oldVariants = this.#draft.getValue()?.variants || []; const variants = partialUpdateFrozenArray( oldVariants, { name }, variantId ? (x) => variantId.compare(x) : () => true ); + console.log(variants); this.#draft.update({ variants }); } diff --git a/src/Umbraco.Web.UI.Client/src/packages/tags/repository/tag.repository.ts b/src/Umbraco.Web.UI.Client/src/packages/tags/repository/tag.repository.ts index 9c72e60885..49a4ea74b9 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/tags/repository/tag.repository.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/tags/repository/tag.repository.ts @@ -42,7 +42,7 @@ export class UmbTagRepository { if (data) { // TODO: allow to append an array of items to the store - // TODO: append culture? "Invariant" if null. + // TODO: Lone: append culture? "Invariant" if null. Niels: Actually, as of my current stand point, I think we should aim for invariant to be the value of ´null´. data.items.forEach((x) => this.#tagStore?.append(x)); }