fix peek error circular reference (#18307)
* move error viewer modal * late import for peek error
This commit is contained in:
@@ -11,7 +11,6 @@ import { manifests as iconRegistryManifests } from './icon-registry/manifests.js
|
||||
import { manifests as localizationManifests } from './localization/manifests.js';
|
||||
import { manifests as menuManifests } from './menu/manifests.js';
|
||||
import { manifests as modalManifests } from './modal/manifests.js';
|
||||
import { manifests as notificationManifests } from './notification/manifests.js';
|
||||
import { manifests as pickerManifests } from './picker/manifests.js';
|
||||
import { manifests as propertyActionManifests } from './property-action/manifests.js';
|
||||
import { manifests as propertyEditorManifests } from './property-editor/manifests.js';
|
||||
@@ -41,7 +40,6 @@ export const manifests: Array<UmbExtensionManifest | UmbExtensionManifestKind> =
|
||||
...localizationManifests,
|
||||
...menuManifests,
|
||||
...modalManifests,
|
||||
...notificationManifests,
|
||||
...pickerManifests,
|
||||
...propertyActionManifests,
|
||||
...propertyEditorManifests,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { UmbPeekErrorArgs } from '../../../notification/types.js';
|
||||
import { UmbModalToken } from '@umbraco-cms/backoffice/modal';
|
||||
import type { UmbPeekErrorArgs } from '../../types.js';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
||||
export interface UmbErrorViewerModalData extends UmbPeekErrorArgs {}
|
||||
@@ -0,0 +1,10 @@
|
||||
import type { ManifestModal } from '@umbraco-cms/backoffice/modal';
|
||||
|
||||
export const manifests: Array<ManifestModal> = [
|
||||
{
|
||||
type: 'modal',
|
||||
alias: 'Umb.Modal.ErrorViewer',
|
||||
name: 'Error Viewer Modal',
|
||||
element: () => import('./error-viewer-modal.element.js'),
|
||||
},
|
||||
];
|
||||
@@ -1,3 +1,4 @@
|
||||
export * from './confirm/index.js';
|
||||
export * from './discard-changes/index.js';
|
||||
export * from './error-viewer/index.js';
|
||||
export * from './item-picker/index.js';
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import { manifests as confirmManifests } from './confirm/manifests.js';
|
||||
import { manifests as discardChangesManifests } from './discard-changes/manifests.js';
|
||||
import { manifests as errorViewerManifests } from './error-viewer/manifest.js';
|
||||
import { manifests as itemPickerManifests } from './item-picker/manifests.js';
|
||||
|
||||
export const manifests: Array<UmbExtensionManifest> = [
|
||||
...confirmManifests,
|
||||
...discardChangesManifests,
|
||||
...errorViewerManifests,
|
||||
...itemPickerManifests,
|
||||
];
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import type { UmbNotificationHandler } from '../../notification-handler.js';
|
||||
import type { UmbPeekErrorArgs } from '../../types.js';
|
||||
import { customElement, html, ifDefined, nothing, property } from '@umbraco-cms/backoffice/external/lit';
|
||||
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
|
||||
import type { UmbNotificationHandler } from '../../notification-handler.js';
|
||||
import { UMB_MODAL_MANAGER_CONTEXT } from '@umbraco-cms/backoffice/modal';
|
||||
import type { UmbPeekErrorArgs } from '../../types.js';
|
||||
import { UMB_ERROR_VIEWER_MODAL } from '../../index.js';
|
||||
import { UMB_ERROR_VIEWER_MODAL, UMB_MODAL_MANAGER_CONTEXT } from '@umbraco-cms/backoffice/modal';
|
||||
|
||||
@customElement('umb-peek-error-notification')
|
||||
export class UmbPeekErrorNotificationElement extends UmbLitElement {
|
||||
|
||||
@@ -2,7 +2,6 @@ import './layouts/default/index.js';
|
||||
export * from './controllers/peek-error/index.js';
|
||||
export * from './extractUmbNotificationColor.function.js';
|
||||
export * from './isUmbNotifications.function.js';
|
||||
export * from './modals/error-viewer/index.js';
|
||||
export * from './notification-handler.js';
|
||||
export * from './notification.context.js';
|
||||
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
import { manifest } from './modals/error-viewer/manifest.js';
|
||||
|
||||
export const manifests = [manifest];
|
||||
@@ -1,8 +0,0 @@
|
||||
import type { ManifestModal } from '@umbraco-cms/backoffice/modal';
|
||||
|
||||
export const manifest: ManifestModal = {
|
||||
type: 'modal',
|
||||
alias: 'Umb.Modal.ErrorViewer',
|
||||
name: 'Error Viewer Modal',
|
||||
element: () => import('./error-viewer-modal.element.js'),
|
||||
};
|
||||
@@ -1,9 +1,9 @@
|
||||
import { UmbNotificationHandler } from './notification-handler.js';
|
||||
import type { UmbNotificationColor, UmbNotificationOptions } from './types.js';
|
||||
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
|
||||
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
|
||||
import { UmbContextBase } from '@umbraco-cms/backoffice/class-api';
|
||||
import { UmbBasicState } from '@umbraco-cms/backoffice/observable-api';
|
||||
import type { UmbNotificationColor, UmbNotificationOptions } from './types.js';
|
||||
|
||||
export class UmbNotificationContext extends UmbContextBase<UmbNotificationContext> {
|
||||
// Notice this cannot use UniqueBehaviorSubject as it holds a HTML Element. which cannot be Serialized to JSON (it has some circular references)
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import { UMB_AUTH_CONTEXT } from '../auth/index.js';
|
||||
import { UmbDeprecation } from '../utils/deprecation/deprecation.js';
|
||||
import { isApiError, isCancelError, isCancelablePromise } from './apiTypeValidators.function.js';
|
||||
import type { XhrRequestOptions } from './types.js';
|
||||
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
|
||||
import { UmbControllerBase } from '@umbraco-cms/backoffice/class-api';
|
||||
import { umbPeekError, type UmbNotificationOptions } from '@umbraco-cms/backoffice/notification';
|
||||
import type { UmbNotificationOptions } from '@umbraco-cms/backoffice/notification';
|
||||
import type { UmbDataSourceResponse } from '@umbraco-cms/backoffice/repository';
|
||||
import {
|
||||
ApiError,
|
||||
@@ -12,7 +13,6 @@ import {
|
||||
CancelError,
|
||||
type ProblemDetails,
|
||||
} from '@umbraco-cms/backoffice/external/backend-api';
|
||||
import { UmbDeprecation } from '../utils/deprecation/deprecation.js';
|
||||
|
||||
export class UmbResourceController extends UmbControllerBase {
|
||||
#promise: Promise<any>;
|
||||
@@ -128,7 +128,8 @@ export class UmbResourceController extends UmbControllerBase {
|
||||
'The Umbraco object cache is corrupt, but your action may still have been executed. Please restart the server to reset the cache. This is a work in progress.';
|
||||
}
|
||||
|
||||
umbPeekError(this, {
|
||||
// This late importing is done to avoid circular reference [NL]
|
||||
(await import('@umbraco-cms/backoffice/notification')).umbPeekError(this, {
|
||||
headline: headline,
|
||||
message: message,
|
||||
details: problemDetails?.errors ?? problemDetails?.detail,
|
||||
@@ -152,7 +153,8 @@ export class UmbResourceController extends UmbControllerBase {
|
||||
});
|
||||
*/
|
||||
const headline = problemDetails?.title ?? error.name ?? 'Server Error';
|
||||
umbPeekError(this, {
|
||||
// This late importing is done to avoid circular reference [NL]
|
||||
(await import('@umbraco-cms/backoffice/notification')).umbPeekError(this, {
|
||||
message: headline,
|
||||
details: problemDetails?.errors ?? problemDetails?.detail,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user