Skip to content
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

Merged
merged 3 commits into from
Jun 18, 2024

Conversation

thecalcc
Copy link
Contributor

@thecalcc thecalcc commented Jun 18, 2024

SDESK-7303

@thecalcc thecalcc requested a review from tomaskikutis June 18, 2024 08:24
super(props);

this.state = {
widgetDisplayed: this.props.widget.active?.component ?? this.props.widget?.pinnedWidget?.component,
Copy link
Member

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) {
Copy link
Member

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?

Copy link
Contributor Author

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 -->
Copy link
Member

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"

@thecalcc thecalcc merged commit 9b1f69d into superdesk:develop Jun 18, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants