Automattic / studio

Studio by WordPress.com, a free desktop app that helps developers streamline their local WordPress development workflow.
https://developer.wordpress.com/studio/
GNU General Public License v2.0
138 stars 12 forks source link

Studio: Add chat context #252

Closed kozer closed 1 week ago

kozer commented 1 week ago

Proposed Changes

This PR handles adding extra chat context to the API request. Fixes: https://github.com/Automattic/dotcom-forge/issues/7601

Testing Instructions

  1. Apply D152354-code
  2. Run the above Studio pr locally.
  3. Make sure you have at least 1 site.
  4. Make questions related to your site:

eg: what is my wordpress version? What is my php version? What are my themes?

  1. Ensure that you get the correct response like below:

2024-06-17T12:24:12,515900609+03:00 2024-06-17T12:24:21,565267570+03:00 2024-06-17T12:24:30,996942316+03:00

Pre-merge Checklist

kozer commented 1 week ago

NOTE: We ll need to change things if https://github.com/Automattic/studio/pull/213 is merged first.

kozer commented 1 week ago

@fluiddot , I did all the changes you requested. Can you please check again? Thanks!

fluiddot commented 1 week ago

@fluiddot , I did all the changes you requested. Can you please check again? Thanks!

They look great, thanks 🙇 !

fluiddot commented 1 week ago

I have a concern about running wp-cli commands multiple times when the site or focus changes. I found that changing the site in the left sidebar has a performance issue and freezes the app, even in the overview tab. Is possible to fix it?

Oh, I've just noticed this issue when selecting different sites, thanks for spotting it @sejas. Sorry to overlook it when testing it, as it severely impacts the performance of basic actions like selecting sites 😞 .

I think the main problem comes from the fact that the initial load is only marked as complete when all promises are finished (reference). A potential workaround could be to mark it as complete right before invoking the promises to avoid executing the wp-cli commands multiple times. In case they fail, we could mark the initial load as empty to let the app try again later on.

Another enhancement would be to debounce the run to avoid invoking multiple times the wp-cli commands when selecting different sites quickly.