studio icon indicating copy to clipboard operation
studio copied to clipboard

The "Add site" action doesn't work if there is no site

Open t-hamano opened this issue 1 year ago • 1 comments

Quick summary

The "Add site" action doesn't work if there is no site.

https://github.com/user-attachments/assets/7b5407c1-f0ef-40ad-8d29-6394175cf2fb

Steps to reproduce

  • Delete all sites.
  • From the app menu, access File > Add site.

What you expected to happen

The "Add site" modal should open.

What actually happened

Nothing happen.

Impact

One

Available workarounds?

No but the app is still usable

Platform

Windows

Logs or notes

Studio version: 1.0.6 OS: Windows 11

t-hamano avatar Jul 23 '24 04:07 t-hamano

Thanks for reporting this one, @t-hamano! Good catch.

I'm able to reproduce this in Mac, too:

https://github.com/user-attachments/assets/b8c03e3a-d696-499a-aa75-44264f8dc2a7

jartes avatar Jul 23 '24 15:07 jartes

@wojtekn what is the expected behaviour here? The Add Site opens a very similar form to the onboarding form? In that case, should that shortcut be enabled at all when the screen presented is the onboarding screen?

katinthehatsite avatar Aug 22 '24 08:08 katinthehatsite

[...] should that shortcut be enabled at all when the screen presented is the onboarding screen?

I believe this is the way to go - we should disable this item during onboarding.

wojtekn avatar Aug 22 '24 08:08 wojtekn

@katinthehatsite I think it might be better to go with the original approach and disable the menu item during onboarding.

Now, the menu item behaves inconsistently:

  • it opens the form when there are any sites already
  • it submits the form when there are no sites

wojtekn avatar Sep 10 '24 08:09 wojtekn

@wojtekn I will take a look if this would be possible. Here is some context as to why we decided to handle it differently in the first place:

  • we can easily check if the user has any sites created or not (this is the condition that we use to determine if the onboarding screen should be displayed or not) and disable or enable the menu item Add site based on that;
  • so we can have something like this: the app starts with Add site button disabled and the onboarding screen if the user has no sites or the app starts with Add site menu item enabled if the user has sites;
  • the tricky part is when the user starts with onboarding screen and then creates a site without re-starting the app: the top menu is created as a part of the main window so it is already there and it does not dynamically change. This means that we have to somehow re-render the main window so that the topbar menu also re-renders when this condition changes and i have not found a straightforward way to do this yet (I will keep on checking)
  • Alternatively, we could avoid re-rendering the main window and the topbar and accept the tradeoff of that menu item not changing dynamically until the app restarts

katinthehatsite avatar Sep 26 '24 12:09 katinthehatsite

I investigated some more and will attempt a solution tomorrow

katinthehatsite avatar Sep 26 '24 18:09 katinthehatsite