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: '='
|
||||
});
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
export enum RootScopeMessages {
|
||||
ReloadExtendedData = 'reload-ext-data',
|
||||
NewUpdateAvailable = 'new-update-available'
|
||||
}
|
||||
|
||||
@@ -113,7 +113,6 @@
|
||||
on-load='self.onEditorLoad',
|
||||
application='self.application'
|
||||
app-state='self.appState'
|
||||
broadcast='$broadcast'
|
||||
)
|
||||
textarea#note-text-editor.editable.font-editor(
|
||||
dir='auto',
|
||||
@@ -171,5 +170,4 @@
|
||||
ng-show='!self.stackComponentHidden(component)',
|
||||
application='self.application'
|
||||
app-state='self.appState'
|
||||
broadcast='$broadcast'
|
||||
)
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
component-uuid='self.component.uuid',
|
||||
application='self.application'
|
||||
app-state='self.appState'
|
||||
broadcast='$broadcast'
|
||||
)
|
||||
#tags-content.content(ng-if='!(self.component && self.component.active)')
|
||||
.tags-title-section.section-title-bar
|
||||
|
||||
@@ -15,5 +15,4 @@
|
||||
component-uuid="ctrl.component.uuid",
|
||||
application='ctrl.application'
|
||||
app-state='self.appState'
|
||||
broadcast='$broadcast'
|
||||
)
|
||||
|
||||
@@ -34,5 +34,4 @@
|
||||
template-component="ctrl.state.editor",
|
||||
application='ctrl.application'
|
||||
app-state='self.appState'
|
||||
broadcast='$broadcast'
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user