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: edit/move modals for projects in workspaces unexpectedly closes [DET-10388] #9588

Merged
merged 2 commits into from
Jun 27, 2024

Conversation

eecsliu
Copy link
Contributor

@eecsliu eecsliu commented Jun 27, 2024

Ticket

Description

Projects (under workspaces) modals get closed randomly when in list view and RBAC enabled. This change band-aids the problem by making sure the problematic code doesn't get called unless it has to.

Test Plan

  1. Open devcluster with this version + RBAC enabled.
  2. Create two workspaces (A and B), and inside workspace A create a project (A1).
  3. Navigate to workspace A and show a list view of projects
  4. In the list view, click on the project actions for A1 and select the move action
  5. Before selecting the destination workspace, wait 5-10 seconds. Make sure the modal does not disappear in this time period.
  6. Select the destination workspace and continue. The workspace should be moved properly.
  7. Next, navigate to the workspace B and show a list view of the projects. You should see A1 there.
  8. Select the actions expansion and click "Edit"
  9. Repeat step 5, then complete editing and make sure changes are upserted.

Checklist

  • Changes have been manually QA'd
  • New features have been approved by the corresponding PM
  • User-facing API changes have the "User-facing API Change" label
  • Release notes have been added as a separate file under docs/release-notes/
    See Release Note for details.
  • Licenses have been included for new code which was copied and/or modified from any external code

@eecsliu eecsliu requested review from maxrussell and a team June 27, 2024 20:03
@eecsliu eecsliu requested a review from a team as a code owner June 27, 2024 20:03
@cla-bot cla-bot bot added the cla-signed label Jun 27, 2024
Copy link

netlify bot commented Jun 27, 2024

Deploy Preview for determined-ui ready!

Name Link
🔨 Latest commit d96c9d3
🔍 Latest deploy log https://app.netlify.com/sites/determined-ui/deploys/667dee874810400008c8d007
😎 Deploy Preview https://deploy-preview-9588--determined-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

codecov bot commented Jun 27, 2024

Codecov Report

Attention: Patch coverage is 0% with 28 lines in your changes missing coverage. Please review.

Project coverage is 45.26%. Comparing base (13e92e4) to head (73e072b).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9588      +/-   ##
==========================================
- Coverage   49.86%   45.26%   -4.61%     
==========================================
  Files        1247      923     -324     
  Lines      162293   121980   -40313     
  Branches     2887     2887              
==========================================
- Hits        80922    55209   -25713     
+ Misses      81200    66600   -14600     
  Partials      171      171              
Flag Coverage Δ
harness ?
web 46.21% <0.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
webui/react/src/pages/WorkspaceDetails.tsx 0.00% <0.00%> (ø)

... and 324 files with indirect coverage changes

@eecsliu eecsliu requested review from a team and removed request for a team and keita-determined June 27, 2024 20:49

if (!_.isEqual(workspaceAssignments, response.assignments)) {
setWorkspaceAssignments(response.assignments);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer to write this kind of logic as something like

setWorkspaceAssignments(prev => _.isEqual(prev, response.assignments) ? prev : response.assignments);

Copy link
Contributor

@gt2345 gt2345 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic looks good to me, but I usually prefer to use the prev callback function instead of monitoring the state

@eecsliu eecsliu force-pushed the fix-project-modals-closing branch from 73e072b to bc7c824 Compare June 27, 2024 22:27
@keita-determined keita-determined added the to-cherry-pick Pull requests that need to be cherry-picked into the current release label Jun 27, 2024
_.isEqual(prev, response.assignments) ? prev : response.assignments,
);
} catch (e) {
handleError(e, { silent: true });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
handleError(e, { silent: true });
handleError(e, { silent: false });

@eecsliu eecsliu merged commit e4724dd into main Jun 27, 2024
77 of 90 checks passed
@eecsliu eecsliu deleted the fix-project-modals-closing branch June 27, 2024 23:21
github-actions bot pushed a commit that referenced this pull request Jun 27, 2024
…ET-10388] (#9588)

Co-authored-by: Max R <max.russell@hpe.com>
Co-authored-by: Ashton G <ashton.galloway@hpe.com>
(cherry picked from commit e4724dd)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed to-cherry-pick Pull requests that need to be cherry-picked into the current release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants