microsoft / microsoft/PowerBI-visuals-tools

[BUG] VisualUpdateType is incorrect in options.type of the update function

Open
#528 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
435
Forks
168
PR merge metrics
No merged PRs in 30d

Description

Issue Description:

There seems to be a bug in the options.type (from the VisualUpdateOptions object) passed to the update function of the IVisual class.

While implementing logic to handle different update types using the VisualUpdateType flags (https://github.com/microsoft/PowerBI-visuals-tools/issues/422#issuecomment-1430492992), I noticed inconsistent behavior, especially when changing styles.

Steps to Reproduce:
Implement the following update function:
public async update(options: VisualUpdateOptions) {
  console.log('options.type', options.type);

  if (VisualUpdateType.Data === (options.type & VisualUpdateType.Data)) {
    console.log('data update');
  }
  if (VisualUpdateType.Resize === (options.type & VisualUpdateType.Resize)) {
    console.log('resize update');
  }
  if (VisualUpdateType.ViewMode === (options.type & VisualUpdateType.ViewMode)) {
    console.log('view mode update');
  }
  if (VisualUpdateType.Style === (options.type & VisualUpdateType.Style)) {
    console.log('style update');
  }
  if (VisualUpdateType.ResizeEnd === (options.type & VisualUpdateType.ResizeEnd)) {
    console.log('resize end update');
  }
  if (VisualUpdateType.FormattingSubSelectionChange === (options.type & VisualUpdateType.FormattingSubSelectionChange)) {
    console.log('formatting sub-selection change update');
  }
  if (VisualUpdateType.FormatModeChange === (options.type & VisualUpdateType.FormatModeChange)) {
    console.log('format mode change update');
  }
  if (VisualUpdateType.FilterOptionsChange === (options.type & VisualUpdateType.FilterOptionsChange)) {
    console.log('filter options change update');
  }
  if (VisualUpdateType.All === (options.type & VisualUpdateType.All)) {
    console.log('all updates');
  }
}
Change any style in the visual:
  • First change: The console logs a formatting sub-selection change update event, as expected.
  • Subsequent changes: The console logs a data update event, which seems incorrect.

Image

Expected Behavior:

The event returned in options.type should consistently reflect the change as formatting sub-selection change update for all style modifications, instead of switching to data update.

Environment:

SDK Version: 5.11.0
Browser/Platform: Edge/Windows 11

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the IVisual update function and the VisualUpdateType flags, then reproduce the issue using SDK 5.11.0 by changing a visual style repeatedly and logging options.type. Done means subsequent style changes consistently report the formatting sub-selection change flag rather than a data update.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.