Skip to content

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

@luizzappa

Description

@luizzappa

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 (#422 (comment)), 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions