Skip to content

Staging sites: keep track of deletion status in state #103471

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

Conversation

gcsecsey
Copy link
Contributor

Fixes DOTDEV-30 Staging Sites: Switching to a different tab while the staging site is being deleted makes the progress bar disappear

Proposed Changes

  • Modified useDeleteStagingSite hook to use Redux state for tracking deletion progress instead of local state
  • Added query invalidation to ensure staging site data is refreshed after deletion
  • Improved state management to maintain consistency between Redux state and local component state

Why are these changes being made?

When we initiate a staging site deletion and then switch to a different tab, the progress bar disappears. I also noticed that the Staging Site card shows the earlier state for about 3 seconds when the deletion is complete.

Testing Instructions

  1. Create a staging site for a site
  2. Initiate deletion of the staging site
  3. While deletion is in progress:
    • Switch to a different tab
    • Return to the staging site tab
    • Verify that the progress bar is still visible
  4. Wait for deletion to complete:
    • Verify that the success notice appears
    • Verify that the staging site card updates to show the "Add Staging Site" state
    • Verify that no stale data is shown
CleanShot.2025-05-15.at.15.59.27.mp4

Pre-merge Checklist

  • Has the general commit checklist been followed? (PCYsg-hS-p2)
  • Have you written new tests for your changes?
  • Have you tested the feature in Simple (P9HQHe-k8-p2), Atomic (P9HQHe-jW-p2), and self-hosted Jetpack sites (PCYsg-g6b-p2)?
  • Have you checked for TypeScript, React or other console errors?
  • Have you used memoizing on expensive computations? More info in Memoizing with create-selector and Using memoizing selectors and Our Approach to Data
  • Have we added the "[Status] String Freeze" label as soon as any new strings were ready for translation (p4TIVU-5Jq-p2)?
    • For UI changes, have we tested the change in various languages (for example, ES, PT, FR, or DE)? The length of text and words vary significantly between languages.
  • For changes affecting Jetpack: Have we added the "[Status] Needs Privacy Updates" label if this pull request changes what data or activity we track or use (p4TIVU-aUh-p2)?

@gcsecsey gcsecsey requested a review from a team May 15, 2025 15:20
@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label May 15, 2025
Copy link

github-actions bot commented May 15, 2025

@matticbot
Copy link
Contributor

This PR modifies the release build for the following Calypso Apps:

For info about this notification, see here: PCYsg-OT6-p2

  • blaze-dashboard
  • notifications
  • odyssey-stats

To test WordPress.com changes, run install-plugin.sh $pluginSlug dotdev-30-staging-sites-switching-to-a-different-tab-while-the-staging on your sandbox.

@matticbot
Copy link
Contributor

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

Sections (~62 bytes added 📈 [gzipped])

name          parsed_size           gzip_size
staging-site       +194 B  (+0.0%)      +62 B  (+0.0%)

Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to.

Legend

What is parsed and gzip size?

Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory.
Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Generated by performance advisor bot at iscalypsofastyet.com.

Copy link
Contributor

@nightnei nightnei left a comment

Choose a reason for hiding this comment

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

The code looks good to me and I tested prod and this branch - now the flow of deleting is stable 👍

@gcsecsey gcsecsey merged commit 5018526 into trunk May 16, 2025
16 checks passed
@gcsecsey gcsecsey deleted the dotdev-30-staging-sites-switching-to-a-different-tab-while-the-staging branch May 16, 2025 09:50
@github-actions github-actions bot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label May 16, 2025
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.

3 participants