feat: remove broadcasting Extensions Manager events from ComponentView (#703)
* feat: remove `broadcast` from `ComponentView` As "Extensions Manager" is removed, the related events' broadcasting is not needed anymore * fix: restore `manualDealloc`
This commit is contained in:
@@ -2,7 +2,7 @@ import { FunctionalComponent } from 'preact';
|
||||
|
||||
interface IProps {
|
||||
expiredDate: string;
|
||||
reloadStatus: (doManualReload?: boolean) => void;
|
||||
reloadStatus: () => void;
|
||||
}
|
||||
|
||||
export const IsExpired: FunctionalComponent<IProps> = ({
|
||||
@@ -35,7 +35,7 @@ export const IsExpired: FunctionalComponent<IProps> = ({
|
||||
</div>
|
||||
</div>
|
||||
<div className={'right'}>
|
||||
<div className={'sk-app-bar-item'} onClick={() => reloadStatus(true)}>
|
||||
<div className={'sk-app-bar-item'} onClick={() => reloadStatus()}>
|
||||
<button className={'sn-button small info'}>Reload</button>
|
||||
</div>
|
||||
<div className={'sk-app-bar-item'}>
|
||||
|
||||
@@ -2,7 +2,7 @@ import { FunctionalComponent } from 'preact';
|
||||
|
||||
interface IProps {
|
||||
isReloading: boolean;
|
||||
reloadStatus: (doManualReload?: boolean) => void;
|
||||
reloadStatus: () => void;
|
||||
}
|
||||
|
||||
export const OfflineRestricted: FunctionalComponent<IProps> = ({
|
||||
|
||||
@@ -5,7 +5,6 @@ import { toDirective } from '@/components/utils';
|
||||
import { useCallback, useEffect, useRef, useState } from 'preact/hooks';
|
||||
import { observer } from 'mobx-react-lite';
|
||||
import { isDesktopApplication } from '@/utils';
|
||||
import { RootScopeMessages } from '@/messages';
|
||||
import { OfflineRestricted } from '@/components/ComponentView/OfflineRestricted';
|
||||
import { UrlMissing } from '@/components/ComponentView/UrlMissing';
|
||||
import { IsDeprecated } from '@/components/ComponentView/IsDeprecated';
|
||||
@@ -20,7 +19,6 @@ interface IProps {
|
||||
componentUuid: string;
|
||||
onLoad?: (component: SNComponent) => void;
|
||||
templateComponent?: SNComponent;
|
||||
broadcast?: (...args: unknown[]) => unknown;
|
||||
manualDealloc?: boolean;
|
||||
}
|
||||
|
||||
@@ -39,8 +37,7 @@ export const ComponentView: FunctionalComponent<IProps> = observer(
|
||||
onLoad,
|
||||
componentUuid,
|
||||
templateComponent,
|
||||
broadcast,
|
||||
manualDealloc = false
|
||||
manualDealloc = false,
|
||||
}) => {
|
||||
const liveComponentRef = useRef<LiveItem<SNComponent> | null>(null);
|
||||
const iframeRef = useRef<HTMLIFrameElement>(null);
|
||||
@@ -71,7 +68,7 @@ export const ComponentView: FunctionalComponent<IProps> = observer(
|
||||
});
|
||||
};
|
||||
|
||||
const reloadStatus = useCallback((doManualReload = true) => {
|
||||
const reloadStatus = useCallback(() => {
|
||||
if (!component) {
|
||||
return;
|
||||
}
|
||||
@@ -105,12 +102,9 @@ export const ComponentView: FunctionalComponent<IProps> = observer(
|
||||
} else {
|
||||
setError(undefined);
|
||||
}
|
||||
if (isExpired && doManualReload) {
|
||||
broadcast?.(RootScopeMessages.ReloadExtendedData);
|
||||
}
|
||||
setIsDeprecated(component.isDeprecated);
|
||||
setDeprecationMessage(component.package_info.deprecation_message);
|
||||
}, [application.componentManager, broadcast, component, isComponentValid, isExpired]);
|
||||
}, [application.componentManager, component, isComponentValid, isExpired]);
|
||||
|
||||
const dismissDeprecationMessage = () => {
|
||||
setTimeout(() => {
|
||||
@@ -362,6 +356,5 @@ export const ComponentViewDirective = toDirective<IProps>(ComponentView, {
|
||||
onLoad: '=',
|
||||
componentUuid: '=',
|
||||
templateComponent: '=',
|
||||
broadcast: '=',
|
||||
manualDealloc: '='
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user