iTwin / appui

Monorepo for iTwin.js AppUi
MIT License
8 stars 2 forks source link

EditorContainer does not commit when new value is set to the initial value #981

Closed ignas-k closed 2 weeks ago

ignas-k commented 3 weeks ago

Describe the bug

When editor new value is being set to the initial/original value of the editor, it is not commited. The bug is caused by the code below because propertyRecord.value is always the same and therefore the condition passes. When switching to other values it works fine because propertyRecord.value and newValue are different.

To Reproduce

  1. Select the selection tool from the toolbar.
  2. In tool settings, switch to another selection mode - crossing line or box.
  3. Switch back to single selection mode.
  4. Try to select elements in the view.
  5. Notice that instead of using single selection mode, it's still selecting using previously chosen mode (crossing line or box). One of the ways to get back to single selection mode, is to clear selection, as that seem to reset the tool.

Expected Behavior

Should commit the new value even if it the same as the initial/original value.

Screenshots

image

Desktop (please complete the applicable information)

Additional context

Not really sure if propertyRecord.value is supposed to always stay the same or if it should change but the main issue is that when newValue is the same as the original propertyRecord.value it does not commit . Bug was introduced in #928.

Bug originally discovered in https://github.com/iTwin/itwinjs-backlog/issues/1219.