Fix change-start-date resolution - #192
Conversation
…d empty-state messages
| this.host.eventService.renderingStarted(options); | ||
|
|
||
| const dataView: powerbi.DataView = options?.dataViews?.[0]; | ||
| if (this.handleLandingPage(options)) { |
There was a problem hiding this comment.
Regression risk vs. previous behavior: before this change update() always assigned this.settings (even with an undefined dataView, populateFormattingSettingsModel returns a default Settings). The new landing-page branch returns early without setting it, so this.settings stays undefined. The host still calls getFormattingModel() when the visual is selected with no data (the Format pane is available regardless of bound fields; supportsLandingPage doesn't suppress it), and buildFormattingModel dereferences .cards with no null-guard -> TypeError. Suggest still populating settings in the landing branch, e.g. this.settings = this.formattingSettingsService.populateFormattingSettingsModel(Settings, options?.dataViews?.[0]);, or guarding getFormattingModel().
| { | ||
| color: kpiSettings.dateColor.value.value, | ||
| data: `${series.dateDifference} days`, | ||
| data: kpiSettings.showStartDate.value && kpiSettings.percentCalcDate |
There was a problem hiding this comment.
kpiSettings.percentCalcDate reflects only the manually typed start date, so a start date coming from a data-bound changeStartDate field (dataRepresentation.percentCalcDate) won't trigger the "(since ...)" suffix. If this is intentional, please add a short code comment here documenting that the suffix deliberately applies only to the manual start-date input, so it's clear to future readers.
| const template: string = this.constructorOptions.localizationManager?.getDisplayName("Visual_StartDateHint_Invalid") ?? "Visual_StartDateHint_Invalid"; | ||
| message = `\u26A0\uFE0F ${template.replace("${1}", adjustment.requestedText ?? "")}`; | ||
| } else { | ||
| const requested: string = getFormattedDate(adjustment.requestedDate); |
There was a problem hiding this comment.
Hint date uses DefaultDateFormat while the chart formats with settings.date.format.value, so the hint may show a different format than the label. Minor consistency nit.
Fix change-start-date, add landing page and empty states
Start date ("Change start date"):
Landing page & empty states: