Policy List Drawer stays open when the security policy project is changed

Summary

When a project's security policy project is changed, if the policy drawer is open, it stays open and shows data from a policy that is not in the new security policy project

Steps to reproduce

  1. Navigate to a project
  2. Link a security policy project with policies
  3. Select a policy from that security policy project and view its details in the drawer
  4. With the drawer open, link a different security policy project

Example Project

https://staging.gitlab.com/defend-team-test/policy-scan-profile/-/security/policies

What is the current bug behavior?

When a project's security policy project is changed, the drawer stays open and continues to display the selected policy's information

What is the expected correct behavior?

When a project's security policy project is changed, the drawer closes.

Relevant logs and/or screenshots

Screen_Shot_2022-09-15_at_2.06.46_PM

Possible fixes

  • frontend clear the selectedPolicy property in ee/app/assets/javascripts/security_orchestration/components/policies/policies_list.vue when the security policy is changed