New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix updating tabs in Calypso broken by new notebook widget #6716
Conversation
…as shown when editing method in setUp tab.
ifNotEmpty: [ self selectedIndex: (self selectedIndex - 1) \\ self tabs size + 1 ] | ||
ifEmpty: [ self selectedIndex: 0 ]. | ||
|
||
super removeTabIndex: anInteger. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
super implementation performs initial selection reset (self selectedIndex: 0).
It is required to trigger updates of selection when tab is removed. Otherwise new selected tab with same index as removed one will not be updated.
self tabs add: (self newLabelMorph: aStringOrMorph) beforeIndex: index. | ||
selectedIndex >= index ifTrue: [ | ||
"there is now new tab before selected tab" | ||
self selectedIndex: selectedIndex + 1 ]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was a missing part. If we do not shift selection index then widget will think that selection is not changed and will not update inserted tab in case when it will be seleted in subsequent calls.
…logic was not really correct.
…the new selection was passed to the method)
Thanks you denis! |
Having tests is cool. Because this is the only way to control complexity. |
failed test was really related: #6728. |
Try to edit setUp method in setUp tab. After accepting changes the browser will show two setUp tabs. That is the bug caused by new notebook (new widget) integration.
In the history I found that #basicUpdateTools was altered to workaround initial tab updating issue: selecting new methods in same class did not update the tab content. This workaround was wrong. At least it should be implemented in explicit place responsible for tab selections (#restoreSelectedTools). But little debugging shows that it was just an issue with new tab implementation (or superclasses which it's based on):
Therefore here I provide correct fix and revert Calypso method