azuredatastudio icon indicating copy to clipboard operation
azuredatastudio copied to clipboard

Dropdown Component's onValueChanged Functionality Inconsistent with Undefined Value.

Open krritik opened this issue 1 year ago • 1 comments

  • Azure Data Studio Version: 1.47.0
  • OS Version:

Steps to Reproduce:

  • The scenario happens one tries to update the value property of dropdown in the code.
  • Create a dropdown component, e.g., name_dropdown.
  • Execute the following code :
1. await name_dropdown.updateProperty('value', "abc");
2. await name_dropdown.updateProperty('value', undefined);  
3. await name_dropdown.updateProperty('value', "abc");
4. await name_dropdown.updateProperty('value', undefined);
5. await name_dropdown.updateProperty('value', "xyz");

Current Behavior

  • In Step 3, the onValueChanged event is not triggered when setting the value to "abc" because the previous value was also "abc" before setting it to undefined.
  • However, in Step 5, the event is triggered when setting the value to "xyz" because it differs from the value before setting it to undefined ("abc").
  • The same behavior is observed when an empty string is used in place of undefined.

Expected Behavior

  • The onValueChanged event should be triggered in both Step 3 and Step 5 after setting the value to undefined.
  • The event triggering should not be dependent on the previous value before it was set to undefined.

Does this issue occur when all extensions are disabled?: Yes/No

krritik avatar Feb 13 '24 14:02 krritik

When I attempt to reproduce, I only notice the values changing, and onValueChanged is never triggered.

const name_dropdown = view.modelBuilder.dropDown().withProps({
	value: 'one'
}).component();
name_dropdown.onValueChanged(() => {
	console.log('Change');
});
await name_dropdown.updateProperty('value', "abc");
await name_dropdown.updateProperty('value', undefined);
await name_dropdown.updateProperty('value', "abc");
await name_dropdown.updateProperty('value', undefined);
await name_dropdown.updateProperty('value', "xyz");

Note: I have locally turned on console.log

vsots avatar Feb 16 '24 23:02 vsots