): void {
super.willUpdate(changedProperties);
if (changedProperties.has("weavy")) {
const lastContext = changedProperties.get("weavy");
if (lastContext && lastContext !== this.weavy) {
lastContext.removeNetworkListener(this.handleUpdate);
}
if (this.weavy && lastContext !== this.weavy) {
this.weavy.addNetworkListener(this.handleUpdate);
}
}
}
override render() {
return html`
${this.weavy && !this.noNetwork && this.weavy?.network.state === "unreachable"
? html`
${msg("The server is offline, try again in a few minutes...")}
`
: !this.noNetwork && this.weavy?.network.state === "offline"
? html`
${msg("You are currently offline.")}
`
: html`
${msg("Nothing to see here yet.")}
`}
`;
}
override connectedCallback(): void {
super.connectedCallback();
this.weavy?.addNetworkListener(this.handleUpdate);
}
override disconnectedCallback(): void {
super.disconnectedCallback();
this.weavy?.removeNetworkListener(this.handleUpdate);
}
}