-
Notifications
You must be signed in to change notification settings - Fork 86
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 widget pinning state getting reset #4551
Conversation
super(props); | ||
|
||
this.state = { | ||
widgetDisplayed: this.props.widget.active?.component ?? this.props.widget?.pinnedWidget?.component, |
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.
Would it work to get this back inside the render method using the same logic? Adding to state is not preferrable because components are supposed to react to prop changes and adding to state breaks it. Of course it's possible to update state as props change, but if you can use props directly - even better.
@@ -377,7 +378,11 @@ function WidgetsManagerCtrl( | |||
$scope.active.afterClose($scope); | |||
} | |||
|
|||
$scope.active = null; | |||
if ($scope.pinnedWidget != null) { |
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.
shouldn't it close in either case - whether pinned or not?
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.
No logic is correct, such that if you have a pinned widget but then open another one on top of it when you close this "unpinned"/"overlayed" one, the pinned is back to active. If that's not the case and you're just closing a widget then it'd get closed as normally.
'right-extended': active.extended | ||
}" | ||
> | ||
<!-- RIGHT SIDEBAR START --> |
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.
Widget itself is also a part of the sidebar, so the name isn't that good. I'd suggest "available widgets list start/end"
SDESK-7303