Skip to content

Use same state for preview site usage and create preview site button - #1385

Merged
gcsecsey merged 4 commits into
trunkfrom
stu-484-cant-add-more-than-3-preview-sites
May 13, 2025
Merged

Use same state for preview site usage and create preview site button#1385
gcsecsey merged 4 commits into
trunkfrom
stu-484-cant-add-more-than-3-preview-sites

Conversation

@gcsecsey

@gcsecsey gcsecsey commented May 13, 2025

Copy link
Copy Markdown
Member

Related issues

Proposed Changes

While working on 182791-ghe-Automattic/wpcom I ran into the issue of not being able to add more preview sites. The Usage tab showed 9 sites but I couldn't press the Create preview site button to add a new one.

  • Update the snapshot count in create-preview-button.tsx to use the same state as user-settings.tsx for the number of active sites

Testing Instructions

  • Follow the test instructions on 182791-ghe-Automattic/wpcom
  • Make sure that when the usage tab shows <10 active sites, the Create preview site button is enabled
  • Check that when you have 10 active preview sites, the Create preview site button is disabled
9 sites 10 sites
CleanShot 2025-05-13 at 15 21 29@2x CleanShot 2025-05-13 at 15 21 16@2x

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?
@gcsecsey
gcsecsey requested a review from a team May 13, 2025 14:24

@fredrikekelund fredrikekelund left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good catch 👍 I haven't tested it, but I can verify that this is the correct behavior.

@gcsecsey

Copy link
Copy Markdown
Member Author

We double-checked this with @wojtekn just now, and it seems that the root cause of the issue was the state mismatch here, the backend was counting active sites correctly. I went ahead and closed 182791-ghe-Automattic/wpcom now.

@ivan-ottinger ivan-ottinger left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice find! The proposed change looks good and works as expected. 👌🏼

I was able to reproduce the issue with only one active preview site and the PR fixes it:

Before After
Markup on 2025-05-13 at 17:45:53 Markup on 2025-05-13 at 17:53:26
@gcsecsey
gcsecsey merged commit df57f35 into trunk May 13, 2025
@gcsecsey
gcsecsey deleted the stu-484-cant-add-more-than-3-preview-sites branch May 13, 2025 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants