Skip to content

Studio: Disable 'Add site' button when site is being added - #371

Merged
katinthehatsite merged 2 commits into
trunkfrom
fix/disable-add-button-on-site-creation
Jul 19, 2024
Merged

Studio: Disable 'Add site' button when site is being added#371
katinthehatsite merged 2 commits into
trunkfrom
fix/disable-add-button-on-site-creation

Conversation

@katinthehatsite

@katinthehatsite katinthehatsite commented Jul 19, 2024

Copy link
Copy Markdown
Contributor

Closes https://github.com/Automattic/dotcom-forge/issues/8342

Proposed Changes

This PR does the two following things:

  • 'Add site' button is disabled when site is being added
  • User can't open 'Add site' form using keyboard shortcut when site is being added

Testing Instructions

  • Pull the changes from this PR locally
  • Start the app with nvm use && npm install && npm start
  • Click on Add site in the sidebar and start the process
  • Observe that you can see a loading screen
  • Observe that Add site button is disabled while the new site is being created and you can't trigger the modal:
Screenshot 2024-07-19 at 12 19 56 PM
  • Click on Add site in the sidebar and start the process again
  • Press cmd + N on your keyboard
  • Confirm that Add site modal does not appear
  • Wait for the site to be created
  • Press cmd + N on your keyboard
  • Confirm that Add site modal appears

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?
@katinthehatsite katinthehatsite self-assigned this Jul 19, 2024
variant="outlined"
className={ className }
onClick={ openModal }
disabled={ isSiteAdding }

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I tried using isBusy here but it was not good looking in terms of design and also still opened the modal so I prefer to use disabled

@wojtekn wojtekn 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.

The code change looks clear. It works as expected on both macOS and Windows.

@katinthehatsite
katinthehatsite merged commit 3b45b6d into trunk Jul 19, 2024
@katinthehatsite
katinthehatsite deleted the fix/disable-add-button-on-site-creation branch July 19, 2024 15:58

@sejas sejas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for adding this improvement.
I tested it by clicking and using the shortcut cmd+n it works as expected:

OjXUlL.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants