Skip to content

Commit 445652d

Browse files
committed
Merge branch 'release/16.0'
# Conflicts: # tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/ContentWithMultiURLPicker.spec.ts # version.json
2 parents 13e368c + 3f3c9f8 commit 445652d

File tree

34 files changed

+281
-219
lines changed

34 files changed

+281
-219
lines changed

src/Umbraco.Web.UI.Client/examples/modal-routed/dashboard.element.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export class UmbDashboardElement extends UmbElementMixin(LitElement) {
1717
},
1818
{
1919
path: '',
20+
pathMatch: 'full',
2021
redirectTo: 'tab1',
2122
},
2223
];

src/Umbraco.Web.UI.Client/examples/modal-routed/modal/example-modal.element.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export class UmbExampleModal extends UmbModalBaseElement {
1717
},
1818
{
1919
path: '',
20+
pathMatch: 'full',
2021
redirectTo: 'modalOverview',
2122
},
2223
];

src/Umbraco.Web.UI.Client/examples/validation-context/validation-context-dashboard.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,21 @@ export class UmbExampleValidationContextDashboardElement extends UmbLitElement {
4545
},
4646
'observeValidationMessages',
4747
);
48+
});
4849

49-
// Observe all errors
50-
this.validation.messages.messagesOfPathAndDescendant('$.form').subscribe((value) => {
51-
this.totalErrorCount = [...new Set(value.map((x) => x.path))].length;
52-
});
50+
// Observe all errors
51+
this.observe(this.validation.messages.messagesOfPathAndDescendant('$.form'), (value) => {
52+
this.totalErrorCount = [...new Set(value.map((x) => x.path))].length;
53+
});
5354

54-
// Observe errors for tab1, note that we only use part of the full JSONPath
55-
this.validation.messages.messagesOfPathAndDescendant('$.form.tab1').subscribe((value) => {
56-
this.tab1ErrorCount = [...new Set(value.map((x) => x.path))].length;
57-
});
55+
// Observe errors for tab1, note that we only use part of the full JSONPath
56+
this.observe(this.validation.messages.messagesOfPathAndDescendant('$.form.tab1'), (value) => {
57+
this.tab1ErrorCount = [...new Set(value.map((x) => x.path))].length;
58+
});
5859

59-
// Observe errors for tab2, note that we only use part of the full JSONPath
60-
this.validation.messages.messagesOfPathAndDescendant('$.form.tab2').subscribe((value) => {
61-
this.tab2ErrorCount = [...new Set(value.map((x) => x.path))].length;
62-
});
60+
// Observe errors for tab2, note that we only use part of the full JSONPath
61+
this.observe(this.validation.messages.messagesOfPathAndDescendant('$.form.tab2'), (value) => {
62+
this.tab2ErrorCount = [...new Set(value.map((x) => x.path))].length;
6363
});
6464
}
6565

src/Umbraco.Web.UI.Client/src/apps/backoffice/components/backoffice-main.element.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,10 @@ export class UmbBackofficeMainElement extends UmbLitElement {
6363

6464
if (newRoutes.length > 0) {
6565
newRoutes.push({
66+
path: '',
67+
pathMatch: 'full',
68+
awaitStability: true,
6669
redirectTo: newRoutes[0].path,
67-
path: ``,
6870
});
6971

7072
newRoutes.push({

src/Umbraco.Web.UI.Client/src/libs/context-api/consume/context-consumer.test.ts

Lines changed: 27 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { UmbContextProvider } from '../provide/context-provider.js';
22
import { UmbContextToken } from '../token/context-token.js';
33
import type { UmbContextMinimal } from '../types.js';
44
import { UmbContextConsumer } from './context-consumer.js';
5-
import type { UmbContextRequestEventImplementation } from './context-request.event.js';
5+
import { UmbContextRequestEventImplementation } from './context-request.event.js';
66
import { UMB_CONTEXT_REQUEST_EVENT_TYPE } from './context-request.event.js';
77
import { assert, expect, oneEvent } from '@open-wc/testing';
88

@@ -266,7 +266,7 @@ describe('UmbContextConsumer', () => {
266266
localConsumer.hostConnected();
267267
});
268268

269-
it('does not respond to a non existing api alias', (done) => {
269+
it('does not respond to a non existing api alias', async () => {
270270
const provider = new UmbContextProvider(
271271
document.body,
272272
testContextAliasAndApiAlias,
@@ -277,21 +277,19 @@ describe('UmbContextConsumer', () => {
277277
let callbackCount = 0;
278278

279279
const localConsumer = new UmbContextConsumer(element, testContextAliasAndNotExistingApiAlias, (context) => {
280-
callbackCount++;
281-
if (callbackCount === 1) {
282-
expect(context).to.be.undefined;
283-
done();
284-
} else {
285-
assert.fail('Callback should not be called more than once');
286-
}
280+
assert.fail('Callback should not be called more than once');
287281
});
282+
const requestEvent = oneEvent(localConsumer.getHostElement(), UMB_CONTEXT_REQUEST_EVENT_TYPE);
288283
localConsumer.hostConnected();
289284

285+
await requestEvent;
286+
await Promise.resolve();
287+
290288
// Delayed check to make sure the callback is not called.
291-
Promise.resolve().then(() => {
292-
localConsumer.hostDisconnected();
293-
provider.hostDisconnected();
294-
});
289+
290+
expect(callbackCount).to.equal(0, 'Callback should never have been called');
291+
localConsumer.hostDisconnected();
292+
provider.hostDisconnected();
295293
});
296294
});
297295

@@ -368,7 +366,7 @@ describe('UmbContextConsumer', () => {
368366
localConsumer.hostConnected();
369367
});
370368

371-
it('disapproving discriminator does not fire callback', (done) => {
369+
it('disapproving discriminator does not fire callback', async () => {
372370
const provider = new UmbContextProvider(document.body, testContextAlias, new UmbTestContextConsumerClass());
373371
provider.hostConnected();
374372

@@ -379,24 +377,21 @@ describe('UmbContextConsumer', () => {
379377
new UmbContextToken(testContextAlias, undefined, badDiscriminator),
380378
(_instance) => {
381379
callbackCount++;
382-
if (callbackCount === 1) {
383-
expect(_instance).to.be.undefined;
384-
done();
385-
} else {
386-
assert.fail('Callback should not be called more than once');
387-
}
380+
assert.fail('Callback should not be called more than once');
388381
},
389382
);
383+
const requestEvent = oneEvent(localConsumer.getHostElement(), UMB_CONTEXT_REQUEST_EVENT_TYPE);
390384
localConsumer.hostConnected();
391385

392386
// Wait for to ensure the above request didn't succeed:
393-
Promise.resolve().then(() => {
394-
localConsumer.hostDisconnected();
395-
provider.hostDisconnected();
396-
});
387+
await requestEvent;
388+
await Promise.resolve();
389+
expect(callbackCount).to.equal(0, 'Callback should never have been called');
390+
localConsumer.hostDisconnected();
391+
provider.hostDisconnected();
397392
});
398393

399-
it('context api of same context alias will prevent request from propagating', (done) => {
394+
it('context api of same context alias will prevent request from propagating', async () => {
400395
const provider = new UmbContextProvider(document.body, testContextAlias, new UmbTestContextConsumerClass());
401396
provider.hostConnected();
402397

@@ -414,19 +409,18 @@ describe('UmbContextConsumer', () => {
414409
new UmbContextToken(testContextAlias, undefined, discriminator),
415410
(_instance) => {
416411
callbackCount++;
417-
if (callbackCount === 1) {
418-
expect(_instance).to.be.undefined;
419-
done();
420-
}
421412
},
422413
);
414+
const requestEvent = oneEvent(localConsumer.getHostElement(), UMB_CONTEXT_REQUEST_EVENT_TYPE);
423415
localConsumer.hostConnected();
424416

417+
await requestEvent;
418+
await Promise.resolve();
425419
// Wait for to ensure the above request didn't succeed:
426-
Promise.resolve().then(() => {
427-
localConsumer.hostDisconnected();
428-
provider.hostDisconnected();
429-
});
420+
421+
expect(callbackCount).to.equal(0, 'Callback should never have been called');
422+
localConsumer.hostDisconnected();
423+
provider.hostDisconnected();
430424
});
431425

432426
it('context api of same context alias will NOT prevent request from propagating when set to passContextAliasMatches', (done) => {

src/Umbraco.Web.UI.Client/src/libs/context-api/consume/context-consumer.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,7 @@ export class UmbContextConsumer<
219219
this.#raf = undefined;
220220
}
221221

222-
this.#instance = undefined;
223-
this.#callback?.(undefined);
222+
this.#unprovide();
224223
if (this.#promiseRejecter) {
225224
const hostElement = this._retrieveHost();
226225
this.#promiseRejecter(

src/Umbraco.Web.UI.Client/src/libs/controller-api/controller-host.mixin.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ export const UmbControllerHostMixin = <T extends ClassConstructor>(superClass: T
6060
if (this.#attached) {
6161
// If a controller is created on a already attached element, then it will be added directly. This might not be optimal. As the controller it self has not finished its constructor method jet. therefor i postpone the call: [NL]
6262
Promise.resolve().then(() => {
63-
// Extra check to see if we are still attached at this point:
64-
if (this.#attached) {
63+
// Extra check to see if we are still attached and still added at this point:
64+
if (this.#attached && this.#controllers.includes(ctrl)) {
6565
ctrl.hostConnected();
6666
}
6767
});

src/Umbraco.Web.UI.Client/src/packages/block/block/workspace/views/edit/block-workspace-view-edit.element.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ export class UmbBlockWorkspaceViewEditElement extends UmbLitElement implements U
123123
if (!this._hasRootGroups) {
124124
routes.push({
125125
path: '',
126+
pathMatch: 'full',
126127
redirectTo: routes[0]?.path,
127128
});
128129
}

src/Umbraco.Web.UI.Client/src/packages/code-editor/property-editor/property-editor-ui-code-editor.element.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,20 @@ export class UmbPropertyEditorUICodeEditorElement extends UmbLitElement implemen
3838
public set config(config: UmbPropertyEditorConfigCollection | undefined) {
3939
if (!config) return;
4040

41-
this._language = config?.getValueByAlias<CodeEditorLanguage>('language') ?? this.#defaultLanguage;
41+
this._language = this.#getConfiguredLanguage(config);
4242
this._height = Number(config?.getValueByAlias('height')) || 400;
4343
this._lineNumbers = config?.getValueByAlias('lineNumbers') ?? false;
4444
this._minimap = config?.getValueByAlias('minimap') ?? false;
4545
this._wordWrap = config?.getValueByAlias('wordWrap') ?? false;
4646
}
4747

48+
#getConfiguredLanguage(config: UmbPropertyEditorConfigCollection) {
49+
const configuredLanguage = config?.getValueByAlias<CodeEditorLanguage>('language') ?? this.#defaultLanguage;
50+
return Array.isArray(configuredLanguage)
51+
? (configuredLanguage.length > 0 ? configuredLanguage[0] : this.#defaultLanguage)
52+
: configuredLanguage;
53+
}
54+
4855
#onChange(event: UmbInputEvent & { target: UmbCodeEditorElement }) {
4956
if (!(event instanceof UmbInputEvent)) return;
5057
this.value = event.target.code;

src/Umbraco.Web.UI.Client/src/packages/content/content-type/structure/content-type-property-structure-helper.class.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export class UmbContentTypePropertyStructureHelper<T extends UmbContentTypeModel
2626
// State which holds all the properties of the current container, this is a composition of all properties from the containers that matches our target [NL]
2727
#propertyStructure = new UmbArrayState<UmbPropertyTypeModel>([], (x) => x.unique);
2828
readonly propertyStructure = this.#propertyStructure.asObservable();
29+
readonly propertyAliases = this.#propertyStructure.asObservablePart((x) => x.map((e) => e.alias));
2930

3031
constructor(host: UmbControllerHost) {
3132
super(host);

0 commit comments

Comments
 (0)