Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unavailable generation entity from stopping render #6

Merged
merged 1 commit into from
Oct 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/elec-sankey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -580,21 +580,22 @@ export class ElecSankey extends LitElement {
const divArray: TemplateResult[] = [];

const startTerminatorY = 0;

let phantomRate = 0;
const routes = structuredClone(this.generationInRoutes);
if (this._phantomGenerationInRoute !== undefined) {
routes.phantom = this._phantomGenerationInRoute;
phantomRate = this._phantomGenerationInRoute.rate;
}
let i = 0;
// eslint-disable-next-line guard-for-in
for (const key in routes) {
if (Object.prototype.hasOwnProperty.call(routes, key)) {
// const friendlyName = routes.text;
let width = 0;
const rate = routes[key].rate;
const rate = routes[key].rate || 0; // Handle undefined (NaN) rates.
// Most of the time, if the rate is zero, we don't want to draw it.
// Exception is if we have > phantom source.
if (rate || routes.phantom.rate > 0) {
// Exception is if we have a >0 phantom source.
if (rate || phantomRate > 0) {
width = this._rateToWidth(rate);
svgArray.push(
renderFlowByCorners(
Expand Down