PERF: Avoid rendering a component that isn't required most of the time (#21942)
What is this change required? The `enable_offline_indicator` site setting is disabled by default so there is no need for us to be rendering an extra Ember component when the site setting is not enabled.
This commit is contained in:
parent
1cbc65ba79
commit
f682071ed0
|
@ -4,13 +4,9 @@ import { inject as service } from "@ember/service";
|
|||
|
||||
export default class OfflineIndicator extends Component {
|
||||
@service messageBusConnectivity;
|
||||
@service siteSettings;
|
||||
|
||||
get showing() {
|
||||
return (
|
||||
this.siteSettings.enable_offline_indicator &&
|
||||
!this.messageBusConnectivity.connected
|
||||
);
|
||||
return !this.messageBusConnectivity.connected;
|
||||
}
|
||||
|
||||
@action
|
||||
|
|
|
@ -8,6 +8,7 @@ export default class MessageBusConnectivity extends Service {
|
|||
|
||||
setConnectivity(connected) {
|
||||
this.connected = connected;
|
||||
|
||||
document.documentElement.classList.toggle(
|
||||
CONNECTIVITY_ERROR_CLASS,
|
||||
!connected
|
||||
|
|
|
@ -24,7 +24,10 @@
|
|||
{{/if}}
|
||||
|
||||
<SoftwareUpdatePrompt />
|
||||
<OfflineIndicator />
|
||||
|
||||
{{#if this.siteSettings.enable_offline_indicator}}
|
||||
<OfflineIndicator />
|
||||
{{/if}}
|
||||
|
||||
<PluginOutlet
|
||||
@name="below-site-header"
|
||||
|
|
Loading…
Reference in New Issue